Documentation
¶
Overview ¶
Package log provides flexible logging redirection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferLogger ¶
BufferLogger stores all log messages. It is primarily useful during startup when the eventual Logger implementation to use is not yet known.
func (*BufferLogger) Log ¶
func (b *BufferLogger) Log(items ...interface{})
Log records a formatted log message for future retrieval.
func (*BufferLogger) WriteTo ¶
func (b *BufferLogger) WriteTo(l Logger)
WriteTo sends recorded log messages to another Logger in order.
type ConsoleLogger ¶
type ConsoleLogger struct{}
ConsoleLogger sends its input directly to the default Go logger tied to os.Stderr.
func (ConsoleLogger) Log ¶
func (l ConsoleLogger) Log(items ...interface{})
Log sends a message to the default Go logger.
type ContextLogger ¶
type ContextLogger struct {
// contains filtered or unexported fields
}
ContextLogger is a logger that prepends a string to each log message.
func (*ContextLogger) Log ¶
func (c *ContextLogger) Log(items ...interface{})
Log prepends the present context from NewContext and passes the resulting log message to the underlying Logger.
type Logger ¶
type Logger interface {
Log(items ...interface{})
}
Logger is a general-purpose interface for displaying messages.
func NewContext ¶
NewContext creates a new ContextLogger using l as the underlying destination.
type ProxyLogger ¶
ProxyLogger is a stable recipient of log messages that can be configured at runtime to forward the messages to different Logger implementations.
func (*ProxyLogger) Log ¶
func (p *ProxyLogger) Log(items ...interface{})
Log forwards its message to the underlying Logger implementation. Panics if called before the first call to SetLogger.
func (*ProxyLogger) SetLogger ¶
func (p *ProxyLogger) SetLogger(l Logger)
SetLogger assigns an underlying Logger implementation to this ProxyLogger.