Documentation ¶
Overview ¶
Package clogger provides a Logger interface that can be used to log messages and errors
Index ¶
Constants ¶
const ( LevelDebug = Level(iota + 1) LevelInfo LevelWarn LevelError )
Pre-defined log levels.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { WithTags(tags map[string]interface{}) Logger Debug(msg string) Info(msg string) Warn(msg string, err error) Error(msg string, err error) }
Logger can be used to log messages and errors.
func NewNoop ¶
func NewNoop() Logger
NewNoop returns a no-op implementation of Logger. Useful in passing it as a valid logger in unit tests.
func NewRecorder ¶
func NewRecorder(logs *[]RecordedLog) Logger
NewRecorder returns an implementation of Logger that keeps a record of each log. Useful in unit tests when logs need to be tested.
func NewWithConfig ¶
NewWithConfig creates a Logger based on the provided config. Example TOML config: clogger out = "./logs.out" err = "./logs.err".
func NewWithWriters ¶
NewWithWriters creates a Logger that uses the provided writers. out is used for debug and info levels. err is used for warn and error levels.