Documentation
¶
Overview ¶
Package console provides a Transport that writes log entries to stdout/stderr using logfmt-style output (key=value pairs after the message).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
transport.BaseConfig
// MessageField places the joined message text into this key, producing a
// single structured object as the sole log argument.
// When set, DateField and LevelField are also included in that object.
MessageField string
// DateField, when set, emits a timestamp as a logfmt key alongside fields.
// When MessageField is set, the timestamp is included in the structured object instead.
DateField string
// LevelField, when set, emits the log level as a logfmt key alongside fields.
// When MessageField is set, the level is included in the structured object instead.
LevelField string
// DateFn overrides the default ISO-8601 timestamp when DateField is set.
DateFn func() string
// LevelFn overrides the default level string when LevelField is set.
LevelFn func(loglayer.LogLevel) string
// Stringify JSON-encodes the structured object instead of emitting logfmt.
// Only applies when MessageField, DateField, or LevelField is set.
Stringify bool
// MessageFn, when set, formats the entire log output as a single string.
// It receives the full TransportParams and its return value replaces messages.
MessageFn func(params loglayer.TransportParams) string
// Writer overrides the default stdout/stderr selection.
// When set all log levels write to this writer.
Writer io.Writer
}
Config holds configuration options for Transport.
type Transport ¶
type Transport struct {
transport.BaseTransport
// contains filtered or unexported fields
}
Transport writes log entries to stdout (info/debug) or stderr (warn/error/fatal).
func (*Transport) GetLoggerInstance ¶
GetLoggerInstance returns nil; console transport has no underlying logger library.
func (*Transport) SendToLogger ¶
func (c *Transport) SendToLogger(params loglayer.TransportParams)
SendToLogger implements loglayer.Transport.
Click to show internal directories.
Click to hide internal directories.