Documentation ¶
Index ¶
- Constants
- func BurrowFormatLogger(logger kitlog.Logger) *burrowFormatLogger
- func NewFileLogger(path string, formatName string) (kitlog.Logger, error)
- func NewFilterLogger(outputLogger kitlog.Logger, predicate func(keyvals []interface{}) bool) kitlog.Logger
- func NewInfoTraceLogger(outputLogger kitlog.Logger) (types.InfoTraceLogger, channels.Channel)
- func NewMultipleOutputLogger(outputLoggers ...kitlog.Logger) kitlog.Logger
- func NewNoopInfoTraceLogger() types.InfoTraceLogger
- func NewRemoteSyslogLogger(url *url.URL, tag, formatName string) (kitlog.Logger, error)
- func NewStreamLogger(writer io.Writer, formatName string) kitlog.Logger
- func NewSyslogLogger(tag, formatName string) (kitlog.Logger, error)
- func VectorValuedLogger(logger kitlog.Logger) *vectorValuedLogger
- type CaptureLogger
- func (cl *CaptureLogger) BufferLogger() *ChannelLogger
- func (cl *CaptureLogger) Flush()
- func (cl *CaptureLogger) FlushLogLines() [][]interface{}
- func (cl *CaptureLogger) Log(keyvals ...interface{}) error
- func (cl *CaptureLogger) OutputLogger() kitlog.Logger
- func (cl *CaptureLogger) Passthrough() bool
- func (cl *CaptureLogger) SetPassthrough(passthrough bool)
- type ChannelLogger
- func (cl *ChannelLogger) BufferCap() channels.BufferCap
- func (cl *ChannelLogger) BufferLength() int
- func (cl *ChannelLogger) DrainForever(logger kitlog.Logger, errCh channels.Channel)
- func (cl *ChannelLogger) Flush(logger kitlog.Logger) error
- func (cl *ChannelLogger) FlushLogLines() [][]interface{}
- func (cl *ChannelLogger) Log(keyvals ...interface{}) error
- func (cl *ChannelLogger) ReadLogLine() []interface{}
- func (cl *ChannelLogger) Reset()
- func (cl *ChannelLogger) WaitReadLogLine() []interface{}
- type MultipleOutputLogger
Constants ¶
const ( JSONFormat = "json" LogfmtFormat = "logfmt" TerminalFormat = "terminal" )
const (
DefaultLoggingRingBufferCap channels.BufferCap = 100
)
Variables ¶
This section is empty.
Functions ¶
func BurrowFormatLogger ¶ added in v0.17.0
func NewFileLogger ¶ added in v0.17.0
func NewFilterLogger ¶ added in v0.17.0
func NewFilterLogger(outputLogger kitlog.Logger, predicate func(keyvals []interface{}) bool) kitlog.Logger
Creates a logger that removes lines from output when the predicate evaluates true
func NewInfoTraceLogger ¶
Create an InfoTraceLogger by passing the initial outputLogger.
func NewMultipleOutputLogger ¶
Creates a logger that forks log messages to each of its outputLoggers
func NewNoopInfoTraceLogger ¶
func NewNoopInfoTraceLogger() types.InfoTraceLogger
func NewRemoteSyslogLogger ¶ added in v0.17.0
func NewStreamLogger ¶ added in v0.17.0
func NewSyslogLogger ¶ added in v0.17.0
func VectorValuedLogger ¶
Types ¶
type CaptureLogger ¶ added in v0.17.0
func NewCaptureLogger ¶ added in v0.17.0
func NewCaptureLogger(outputLogger kitlog.Logger, bufferCap channels.BufferCap, passthrough bool) *CaptureLogger
Capture logger captures output set to it into a buffer logger and retains a reference to an output logger (the logger whose input it is capturing). It can optionally passthrough logs to the output logger. Because it holds a reference to its output it can also be used to coordinate Flushing of the buffer to the output logger in exceptional circumstances only
func (*CaptureLogger) BufferLogger ¶ added in v0.17.0
func (cl *CaptureLogger) BufferLogger() *ChannelLogger
The BufferLogger where the input into these CaptureLogger is stored in a ring buffer of log lines.
func (*CaptureLogger) Flush ¶ added in v0.17.0
func (cl *CaptureLogger) Flush()
Flushes every log line available in the buffer at the time of calling to the OutputLogger and returns. Does not block indefinitely.
Note: will remove log lines from buffer so they will not be produced on any subsequent flush of buffer
func (*CaptureLogger) FlushLogLines ¶ added in v0.17.0
func (cl *CaptureLogger) FlushLogLines() [][]interface{}
Flushes every log line available in the buffer at the time of calling to a slice and returns it. Does not block indefinitely.
Note: will remove log lines from buffer so they will not be produced on any subsequent flush of buffer
func (*CaptureLogger) Log ¶ added in v0.17.0
func (cl *CaptureLogger) Log(keyvals ...interface{}) error
func (*CaptureLogger) OutputLogger ¶ added in v0.17.0
func (cl *CaptureLogger) OutputLogger() kitlog.Logger
The OutputLogger whose input this CaptureLogger is capturing
func (*CaptureLogger) Passthrough ¶ added in v0.17.0
func (cl *CaptureLogger) Passthrough() bool
Gets whether the CaptureLogger is forwarding log lines sent to through to its OutputLogger. Concurrently Safe.
func (*CaptureLogger) SetPassthrough ¶ added in v0.17.0
func (cl *CaptureLogger) SetPassthrough(passthrough bool)
Sets whether the CaptureLogger is forwarding log lines sent to it through to its output logger. Concurrently safe.
type ChannelLogger ¶
func NewChannelLogger ¶ added in v0.17.0
func NewChannelLogger(loggingRingBufferCap channels.BufferCap) *ChannelLogger
Creates a Logger that uses a uses a non-blocking ring buffered channel. This logger provides a common abstraction for both a buffered, flushable logging cache. And a non-blocking conduit to transmit logs via DrainForever (or NonBlockingLogger).
func NonBlockingLogger ¶
func NonBlockingLogger(outputLogger kitlog.Logger) (*ChannelLogger, channels.Channel)
Returns a Logger that wraps the outputLogger passed and does not block on calls to Log and a channel of any errors from the underlying logger
func (*ChannelLogger) BufferCap ¶ added in v0.17.0
func (cl *ChannelLogger) BufferCap() channels.BufferCap
Get the cap off the internal ring buffer
func (*ChannelLogger) BufferLength ¶ added in v0.17.0
func (cl *ChannelLogger) BufferLength() int
Get the current occupancy level of the ring buffer
func (*ChannelLogger) DrainForever ¶ added in v0.17.0
func (cl *ChannelLogger) DrainForever(logger kitlog.Logger, errCh channels.Channel)
Enters an infinite loop that will drain any log lines from the passed logger. You may pass in a channel
Exits if the channel is closed.
func (*ChannelLogger) Flush ¶ added in v0.17.0
func (cl *ChannelLogger) Flush(logger kitlog.Logger) error
Drains everything that is available at the time of calling
func (*ChannelLogger) FlushLogLines ¶ added in v0.17.0
func (cl *ChannelLogger) FlushLogLines() [][]interface{}
Drains the next contiguous segment of loglines up to the buffer cap waiting for at least one line
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) Reset ¶ added in v0.17.0
func (cl *ChannelLogger) Reset()
Close the existing channel halting goroutines that are draining the channel and create a new channel to buffer into. Should not cause any log lines arriving concurrently to be lost, but any that have not been drained from old channel may be.
func (*ChannelLogger) WaitReadLogLine ¶
func (cl *ChannelLogger) WaitReadLogLine() []interface{}
Read a log line by waiting until one is available and returning it
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