Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Setup ¶
func Setup(config *Config) (*LevelFilter, *GatedWriter, *LogWriter, io.Writer, bool)
Setup is used to perform setup of serveral logging objects
func ValidateLevelFilter ¶
func ValidateLevelFilter(minLevel LogLevel, filter *LevelFilter) bool
ValidateLevelFilter verifies that the log levels within the filter are valid.
Types ¶
type GatedWriter ¶
GatedWriter is an io.Writer implementation that buffers all of its data into an internal buffer until it is told to let data through.
func (*GatedWriter) Flush ¶
func (w *GatedWriter) Flush()
Flush tells the GateWriter to flush any buffered data and to stop buffering.
type LevelFilter ¶
type LevelFilter struct {
Levels []LogLevel
MinLevel LogLevel
Writer io.Writer
// contains filtered or unexported fields
}
LevelFilter is an io.Writer that can be used with a logger that will filter out log message
func NewLevelFilter ¶
func NewLevelFilter() *LevelFilter
NewLevelFilter returns a LevelFilter that is configured with the log levels that we use.
func (*LevelFilter) Check ¶
func (f *LevelFilter) Check(line []byte) bool
Check will check a given line if it would be included in the level filter.
func (*LevelFilter) SetMinLevel ¶
func (f *LevelFilter) SetMinLevel(min LogLevel)
SetMinLevel is used to update the minimum log level
type LogHandler ¶
type LogHandler interface {
HandleLog(string)
}
LogHandler interface is used for clients that want to subscribe to logs
type LogWriter ¶
LogWriter implements io.Writer so it can be used as a log sink.
func NewLogWriter ¶
NewLogWriter creates a LogWriter with the given buffer capacity
func (*LogWriter) DeregisterHandler ¶
func (l *LogWriter) DeregisterHandler(lh LogHandler)
DeregisterHandler removes a LogHandler
func (*LogWriter) RegisterHandler ¶
func (l *LogWriter) RegisterHandler(lh LogHandler)
RegisterHandler adds a log handler to receive logs
type SyslogWrapper ¶
type SyslogWrapper struct {
// contains filtered or unexported fields
}
SyslogWrapper is used to cleanup log messages before writing them to a Syslogger