Documentation ¶
Overview ¶
Package log implements application-level logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logger = logging.MustGetLogger("fossa-cli")
Logger is a re-exported logger from `go-logging`. Originally, we provided wrapper functions around the specific logging methods that we use, but this causes the package, file, and line numbers to be useless (they all point to the wrapper instead of the caller). Instead, we only use the documented log levels below:
_Debug_ messages are used for tracing execution and diagnosing unintended error cases.
_Notice_ messages are non-error events that the user should be informed of, such as notifications that an action has occurred.
_Warning_ messages are non-fatal error events that the user should be informed of. Generally, the user can do something to fix these.
_Fatal_ messages are non-recoverable errors, and cause an `os.Exit(1)`. They should be used for foreseen error conditions that we cannot continue from.
_Panic_ messages are errors that are unforeseen, should never happen, and indicate that something has gone terribly wrong. They are akin to assertion failures, and are generally only used as sanity checks for invariants.
TODO: we can probably write our own logger with runtime.Caller, or use the logger from go-core. It might be helpful to have structured logging here, especially considering how large some entries get.
Functions ¶
func Init ¶ added in v0.7.0
func Init(interactive, debug bool)
Init initializes application-level logging.
If `interactive` is true, then logging will include colors and ANSI codes (e.g. progress spinners). If `debug` is true, then logging will include debugging output.
func PauseSpinner ¶ added in v0.7.0
func PauseSpinner() func()
PauseSpinner pauses the spinner and returns a function for unpausing. TODO: we need to write our own logging functions that use this to prevent interrupting the spinner while logging a message.
func Print ¶ added in v0.6.1
func Print(args ...interface{})
Print outputs a literal message to STDOUT.
func Printf ¶ added in v0.6.1
func Printf(format string, args ...interface{})
Printf outputs a formatted message to STDOUT.
func ShowSpinner ¶ added in v0.6.1
func ShowSpinner(message string)
ShowSpinner shows a progress spinner with a message.