Documentation
¶
Overview ¶
Package log 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) WithContext ¶
WithContext returns a logger with the provided context. Note: charmbracelet/log doesn't have built-in context support, but we maintain this method signature for compatibility.
func (*Logger) WithFields ¶
WithFields returns a logger with the specified key-value pairs.
func (*Logger) WithPrefix ¶
WithPrefix returns a logger with the specified prefix.