Documentation ¶
Index ¶
Constants ¶
View Source
const ( FATAL = 5 ERROR = 4 WARN = 3 IMPORTANT = 2 INFO = 1 DEBUG = 0 )
These are a consistent set of error codes instead of using random non-zero integers
Variables ¶
View Source
var Log *logger
Log is the program's logging package. It is self-initialized (with init() func) so we don't need to do it manually in the client code. It's a dependency the program cannot function without. It's a global variable, because it's a small program, hence it's easier to manage it from a central place. And we don't mutate it's state more than once, only at startup, to set debug and silent modes.
View Source
var LogColors = map[int]*color.Color{ FATAL: color.New(color.FgRed).Add(color.Bold), ERROR: color.New(color.FgRed), WARN: color.New(color.FgYellow), IMPORTANT: color.New(color.Bold), DEBUG: color.New(color.FgCyan).Add(color.Faint), }
LogColors sets the color for each type of logging output
Functions ¶
func NewNoopLogger ¶
func NewNoopLogger()
NewNoopLogger will mutate existing logger, ensuring no output will be sent to stdout useful for testing.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.