Documentation
¶
Overview ¶
Package logging provides centralized logging functionality for the opnDossier application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidLogLevel is returned when an unrecognized log level is specified. ErrInvalidLogLevel = errors.New("invalid log level") // ErrInvalidLogFormat is returned when an unrecognized log format is specified. ErrInvalidLogFormat = errors.New("invalid log format") )
Error definitions for validation.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Level is the log level (debug, info, warn, error)
Level string
// Format is the output format (text, json)
Format string
// Output is the writer to output logs to
Output io.Writer
// ReportCaller enables caller reporting
ReportCaller bool
// ReportTimestamp enables timestamp reporting
ReportTimestamp bool
}
Config holds the logger configuration options.
type Logger ¶
Logger is the application logger instance.
func New ¶
New returns a new Logger instance configured according to the provided Config. It validates the log level and format, sets default output to standard error if unspecified, and applies options for caller and timestamp reporting. The logger's output format and level are set based on the configuration. Returns an error if the log level or format is invalid.
func (*Logger) IsVerbose ¶ added in v1.5.0
IsVerbose reports whether the logger is configured at debug level or more verbose. Use this to gate expensive diagnostics (e.g., full stack dumps via runtime/debug.Stack) behind operator opt-in, so centralized logs never leak internal details like plugin paths or function names at default verbosity.
func (*Logger) WithFields ¶
WithFields returns a logger with the specified key-value pairs.
func (*Logger) WithPrefix ¶
WithPrefix returns a logger with the specified prefix.