Documentation ¶
Overview ¶
Package logger provides Logger, which is a wrapper around zerolog.Logger.
Index ¶
- type ConsoleWriter
- type Context
- type Logger
- func (l Logger) Debug(v ...any)
- func (l Logger) DebugFields(msg string, fields map[string]any)
- func (l Logger) Debugf(format string, v ...any)
- func (l Logger) Error(v ...any)
- func (l Logger) ErrorFields(msg string, fields map[string]any)
- func (l Logger) Errorf(format string, v ...any)
- func (l Logger) Fatal(v ...any)
- func (l Logger) FatalFields(msg string, fields map[string]any)
- func (l Logger) Fatalf(format string, v ...any)
- func (l Logger) Info(v ...any)
- func (l Logger) InfoFields(msg string, fields map[string]any)
- func (l Logger) Infof(format string, v ...any)
- func (l Logger) Panic(v ...any)
- func (l Logger) PanicFields(msg string, fields map[string]any)
- func (l Logger) Panicf(format string, v ...any)
- func (l Logger) Trace(v ...any)
- func (l Logger) TraceFields(msg string, fields map[string]any)
- func (l Logger) Tracef(format string, v ...any)
- func (l Logger) Warn(v ...any)
- func (l Logger) WarnFields(msg string, fields map[string]any)
- func (l Logger) Warnf(format string, v ...any)
- func (l Logger) With() Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleWriter ¶
type ConsoleWriter struct { Out io.Writer // Out is the destination writer for log messages. NoColor bool // NoColor disables ANSI color escape codes in output. TimeFormat string // TimeFormat is the format for timestamps in output. // contains filtered or unexported fields }
ConsoleWriter is a console writer for Logger that writes log messages to the console in a user-friendly format.
func NewConsoleWriter ¶
func NewConsoleWriter(options ...func(w *ConsoleWriter)) *ConsoleWriter
NewConsoleWriter creates a new ConsoleWriter with the specified options.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context configures a new sub-logger with contextual fields.
func (Context) Caller ¶
Caller adds the file:line of the caller with the zerolog.CallerFieldName key.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides a structured and leveled logging interface using zerolog.Logger.
func (Logger) DebugFields ¶
DebugFields logs a message with associated fields at the Debug severity level.
func (Logger) ErrorFields ¶
ErrorFields logs a message with associated fields at the Error severity level.
func (Logger) FatalFields ¶
FatalFields logs a message with associated fields at the Fatal severity level.
func (Logger) InfoFields ¶
InfoFields logs a message with associated fields at the Info severity level.
func (Logger) PanicFields ¶
PanicFields logs a message with associated fields at the Panic severity level.
func (Logger) TraceFields ¶
TraceFields logs a message with associated fields at the Trace severity level.
func (Logger) WarnFields ¶
WarnFields logs a message with associated fields at the Warn severity level.