Documentation ¶
Index ¶
- func Colors(keyvals ...interface{}) term.FgBgColor
- func Msg(logger log.Logger, message string, keyvals ...interface{}) error
- type Logger
- func (l *Logger) InfoMsg(message string, keyvals ...interface{}) error
- func (l *Logger) Reload() error
- func (l *Logger) SwapOutput(infoLogger log.Logger)
- func (l *Logger) Sync() error
- func (l *Logger) TraceMsg(message string, keyvals ...interface{}) error
- func (l *Logger) With(keyvals ...interface{}) *Logger
- func (l *Logger) WithInfo(keyvals ...interface{}) *Logger
- func (l *Logger) WithPrefix(keyvals ...interface{}) *Logger
- func (l *Logger) WithScope(scopeName string) *Logger
- func (l *Logger) WithTrace(keyvals ...interface{}) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶ added in v0.18.0
type Logger struct { // Send a log message to the Info channel, formed of a sequence of key value // pairs. Info messages should be operationally interesting to a human who is // monitoring the logs. But not necessarily a human who is trying to // understand or debug the system. Any handled errors or warnings should be // sent to the Info channel (where you may wish to tag them with a suitable // key-value pair to categorise them as such). Info log.Logger // Send an log message to the Trace channel, formed of a sequence of key-value // pairs. Trace messages can be used for any state change in the system that // may be of interest to a machine consumer or a human who is trying to debug // the system or trying to understand the system in detail. If the messages // are very point-like and contain little structure, consider using a metric // instead. Trace log.Logger Output *log.SwapLogger }
InfoTraceLogger maintains provides two logging 'channels' that are interlaced to provide a coarse grained filter to distinguish human-consumable 'Info' messages and execution level 'Trace' messages.
func NewNoopLogger ¶ added in v0.18.0
func NewNoopLogger() *Logger
func (*Logger) SwapOutput ¶ added in v0.18.0
Hot swap the underlying outputLogger with another one to re-route messages
func (*Logger) With ¶ added in v0.18.0
A logging context (see go-kit log's Context). Takes a sequence key values via With or WithPrefix and ensures future calls to log will have those contextual values appended to the call to an underlying logger. Values can be dynamic by passing an instance of the log.Valuer interface This provides an interface version of the log.Context struct to be used For implementations that wrap a log.Context. In addition it makes no assumption about the name or signature of the logging method(s). See InfoTraceLogger
func (*Logger) WithInfo ¶ added in v0.18.0
Establish a context on the Info channel keeping Trace the same
func (*Logger) WithPrefix ¶ added in v0.18.0
func (*Logger) WithScope ¶ added in v0.18.0
Establish or extend the scope of this logger by appending scopeName to the Scope vector. Like With the logging scope is append only but can be used to provide parenthetical scopes by hanging on to the parent scope and using once the scope has been exited. The scope mechanism does is agnostic to the type of scope so can be used to identify certain segments of the call stack, a lexical scope, or any other nested scope.