Documentation ¶
Index ¶
- Constants
- func ErisFormatLogger(logger kitlog.Logger) *erisFormatLogger
- func NewMultipleOutputLogger(outputLoggers ...kitlog.Logger) kitlog.Logger
- func VectorValuedLogger(logger kitlog.Logger) *vectorValuedLogger
- type ChannelLogger
- type InfoTraceLogger
- type MultipleChannelLogger
- type MultipleOutputLogger
Constants ¶
const ( InfoChannelName = "Info" TraceChannelName = "Trace" InfoLevelName = InfoChannelName TraceLevelName = TraceChannelName )
const (
LoggingRingBufferCap channels.BufferCap = 100
)
Variables ¶
This section is empty.
Functions ¶
func ErisFormatLogger ¶
func NewMultipleOutputLogger ¶
Creates a logger that forks log messages to each of its outputLoggers
func VectorValuedLogger ¶
Types ¶
type ChannelLogger ¶
type ChannelLogger struct {
// contains filtered or unexported fields
}
func NonBlockingLogger ¶
func NonBlockingLogger(logger kitlog.Logger) *ChannelLogger
Wraps an underlying Logger baseLogger to provide a Logger that is is non-blocking on calls to Log.
func (*ChannelLogger) DrainChannelToLogger ¶
func (cl *ChannelLogger) DrainChannelToLogger(logger kitlog.Logger)
Enters an infinite loop that will drain any log lines from the passed logger.
Exits if the channel is closed.
func (*ChannelLogger) Log ¶
func (cl *ChannelLogger) Log(keyvals ...interface{}) error
func (*ChannelLogger) ReadLogLine ¶
func (cl *ChannelLogger) ReadLogLine() []interface{}
Tries to read a log line from the channel buffer or returns nil if none is immediately available
func (*ChannelLogger) WaitReadLogLine ¶
func (cl *ChannelLogger) WaitReadLogLine() []interface{}
Read a log line by waiting until one is available and returning it
type InfoTraceLogger ¶
type InfoTraceLogger interface { // Send a log message to the default channel kitlog.Logger // Send an 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(keyvals ...interface{}) error // 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(keyvals ...interface{}) error // Establish a context by appending contextual key-values to any existing // contextual values With(keyvals ...interface{}) InfoTraceLogger // Establish a context by prepending contextual key-values to any existing // contextual values WithPrefix(keyvals ...interface{}) InfoTraceLogger }
InfoTraceLogger maintains two independent concurrently-safe channels of logging. The idea behind the independence is that you can ignore one channel with no performance penalty. For more fine grained filtering or aggregation the Info and Trace loggers can be decorated loggers that perform arbitrary filtering/routing/aggregation on log messages.
func NewInfoTraceLogger ¶
func NewInfoTraceLogger(infoLogger, traceLogger kitlog.Logger) InfoTraceLogger
func NewNoopInfoTraceLogger ¶
func NewNoopInfoTraceLogger() InfoTraceLogger
type MultipleChannelLogger ¶
This represents a 'SELECT ONE' type logger. When logged to it will search for the ChannelKey field, look that up in its map and send the log line there Otherwise logging is a noop (but an error will be returned - which is optional)
func (MultipleChannelLogger) Log ¶
func (mcl MultipleChannelLogger) Log(keyvals ...interface{}) error
Like go-kit log's Log method only logs a message to the specified channelName which must be a member of this MultipleChannelLogger
type MultipleOutputLogger ¶
This represents an 'AND' type logger. When logged to it will log to each of the loggers in the slice.
func (MultipleOutputLogger) Log ¶
func (mol MultipleOutputLogger) Log(keyvals ...interface{}) error