Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, keyvals ...any)
Info(msg string, keyvals ...any)
Warn(msg string, keyvals ...any)
Error(msg string, keyvals ...any)
With(keyvals ...any) Logger
}
Logger is a small facade over the underlying logging backend. Methods accept a message (event name in snake_case) and structured key/value fields.
func Fanout ¶
Fanout returns a Logger that forwards every log call to all provided sinks. If only one sink is provided, that sink is returned unchanged. This does not modify the behavior or configuration of the provided loggers; it simply aggregates them.
func FromContext ¶
FromContext returns the logger from context or a no-op logger if absent.
type Options ¶
type Options struct {
// Out is the primary destination for human-facing logs. Defaults to os.Stderr.
Out io.Writer
// Level is one of: "debug", "info", "warn", "error". Defaults to "info".
Level string
// Format controls primary output: "auto" (default), "pretty", or "json".
// When "auto", TTY → pretty; non-TTY → json.
Format string
// NoColor disables color in pretty output. For JSON it has no effect.
NoColor bool
// LogFile, when set, enables an additional JSON sink written to this path.
LogFile string
// ReportTimestamp toggles timestamps on the primary sink. Default: true.
ReportTimestamp *bool
}
Options controls logger construction.
type Step ¶
type Step struct {
// contains filtered or unexported fields
}
Step is a helper for emitting started/ok/failed events with consistent keys.
func StartStep ¶
StartStep logs a started event and returns a Step that can be finalized with OK/Fail. Stable keys: action, target, status, changed, duration_ms.