Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureEarlyLogging ¶
func ConfigureEarlyLogging()
ConfigureEarlyLogging installs our logging adapters, and enables early logging to screen if it is enabled by either the FELIX_EARLYLOGSEVERITYSCREEN or FELIX_LOGSEVERITYSCREEN environment variable.
func ConfigureLogging ¶
ConfigureLogging uses the resolved configuration to complete the logging configuration. It creates hooks for the relevant logging targets and attaches them to logrus.
func FormatForSyslog ¶
FormatForSyslog formats logs in a way tailored for syslog. It avoids logging information that is already included in the syslog metadata such as timestamp and PID. The log level _is_ included because syslog doesn't seem to output it by default and it's very useful.
INFO endpoint_mgr.go 434: Skipping configuration of interface because it is oper down. ifaceName="cali1234"
Types ¶
type BackgroundHook ¶
type BackgroundHook struct {
// contains filtered or unexported fields
}
BackgroundHook is a logrus Hook that (synchronously) formats each log and sends it to one or more Destinations for writing ona background thread. It supports filtering destinations on individual log levels. We write logs from background threads so that blocking of the output stream doesn't block the mainline code. Up to a point, we queue logs for writing, then we start dropping logs.
func NewBackgroundHook ¶
func NewBackgroundHook(levels []log.Level, syslogLevel log.Level, destinations []*Destination) *BackgroundHook
func (*BackgroundHook) Levels ¶
func (h *BackgroundHook) Levels() []log.Level
func (*BackgroundHook) Start ¶
func (h *BackgroundHook) Start()
type ContextHook ¶
type ContextHook struct { }
func (ContextHook) Levels ¶
func (hook ContextHook) Levels() []log.Level
type Destination ¶
type Destination struct { // Level is the minimum level that a log must have to be logged to this destination. Level log.Level // contains filtered or unexported fields }
func NewStreamDestination ¶
func NewSyslogDestination ¶
func NewSyslogDestination( level log.Level, writer syslogWriter, c chan QueuedLog, disableLogDropping bool, ) *Destination
func (*Destination) Close ¶
func (d *Destination) Close()
Close closes the channel to the background goroutine. This is only safe to call if you know that the destination is no longer in use by any thread; in tests, for example.
func (*Destination) LoopWritingLogs ¶
func (d *Destination) LoopWritingLogs()
LoopWritingLogs is intended to be used as a background go-routine. It processes the logs from the channel.
func (*Destination) Send ¶
func (d *Destination) Send(ql QueuedLog) (ok bool)
Send sends a log to the background thread. It returns true on success or false if the channel is blocked.
type Formatter ¶
type Formatter struct{}
Formatter is our custom log formatter, which mimics the style used by the Python version of Felix. In particular, it uses a sortable timestamp and it includes the level, PID, file and line number.
2017-01-05 09:17:48.238 [INFO][85386] endpoint_mgr.go 434: Skipping configuration of interface because it is oper down. ifaceName="cali1234"
type NullWriter ¶
type NullWriter struct{}
NullWriter is a dummy writer that always succeeds and does nothing.