Documentation ¶
Overview ¶
Package journalr allows sending log messages to systemd journald via logr.Logger.
Index ¶
- type Sink
- func (s Sink) Enabled(level int) bool
- func (s *Sink) Error(err error, msg string, kvList ...interface{})
- func (s *Sink) Info(level int, msg string, kvList ...interface{})
- func (s *Sink) Init(info logr.RuntimeInfo)
- func (s Sink) WithCallDepth(depth int) logr.LogSink
- func (s Sink) WithName(name string) logr.LogSink
- func (s Sink) WithValues(newValues ...interface{}) logr.LogSink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
Sink is a logr.LogSink that sends structured log messages to systemd journald.
func (Sink) Enabled ¶
Enabled tests whether this LogSink is enabled at the specified V-level. For example, commandline flags might be used to set the logging verbosity and disable some info logs.
func (*Sink) Error ¶
Error logs an error, with the given message and key/value pairs as context. See Logger.Error for more details.
func (*Sink) Info ¶
Info logs a non-error message with the given key/value pairs as context. The level argument is provided for optional logging. This method will only be called when Enabled(level) is true. See Logger.Info for more details.
func (*Sink) Init ¶
func (s *Sink) Init(info logr.RuntimeInfo)
Init receives optional information about the logr library for LogSink implementations that need it.
func (Sink) WithCallDepth ¶
WithCallDepth returns a LogSink that will offset the call stack by the specified number of frames when logging call site information.
If depth is 0, the LogSink should skip exactly the number of call frames defined in RuntimeInfo.CallDepth when Info or Error are called, i.e. the attribution should be to the direct caller of Logger.Info or Logger.Error.
If depth is 1 the attribution should skip 1 call frame, and so on. Successive calls to this are additive.
func (Sink) WithName ¶
WithName returns a new LogSink with the specified name appended. See Logger.WithName for more details.
func (Sink) WithValues ¶
WithValues returns a new LogSink with additional key/value pairs. See Logger.WithValues for more details.