Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevelFilter ¶
func LevelFilter() *logutils.LevelFilter
LevelFilter returns a LevelFilter that is configured with the log levels that we use.
func ValidateLevelFilter ¶
func ValidateLevelFilter(minLevel logutils.LogLevel, filter *logutils.LevelFilter) bool
ValidateLevelFilter verifies that the log levels within the filter are valid.
Types ¶
type LogHandler ¶
type LogHandler interface {
HandleLog(string)
}
LogHandler interface is used for clients that want to subscribe to logs, for example to stream them over an IPC mechanism
type LogRegistrar ¶
LogRegistrar can be used as a log sink. It maintains a circular buffer of logs, and a set of handlers to which it can stream the logs to.
LogRegistrar implements:
- io.Writer interface
LogRegistrar composes:
- LogHandler interface
func NewLogRegistrar ¶
func NewLogRegistrar(buf int) *LogRegistrar
NewLogRegistrar creates a LogRegistrar with the given buffer capacity
func (*LogRegistrar) DeregisterHandler ¶
func (l *LogRegistrar) DeregisterHandler(lh LogHandler)
DeregisterHandler removes a LogHandler and prevents more invocations
func (*LogRegistrar) RegisterHandler ¶
func (l *LogRegistrar) RegisterHandler(lh LogHandler)
RegisterHandler adds a log handler to receive logs, and sends the last buffered logs to the handler
type SyslogWriter ¶
type SyslogWriter struct { GSyslog gsyslog.Syslogger LFilter *logutils.LevelFilter }
SyslogWriter is used to cleaup log messages before writing them to a Syslogger.
Implements the io.Writer interface.