Documentation
¶
Overview ¶
Package logger provides structured logging functionality using zap.
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Init(cfg *Config) error
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type Config
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf logs a formatted debug message
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf logs a formatted error message
Types ¶
type Config ¶
type Config struct {
// Level is the minimum log level to output (debug, info, warn, error)
Level string
// Format determines output format: "console" (human-readable) or "json" (machine-parseable)
Format string
// OutputPath is the file path for log output (empty = stdout only)
OutputPath string
// EnableCaller adds caller information to log entries
EnableCaller bool
// EnableStacktrace adds stack traces to error-level logs
EnableStacktrace bool
}
Config holds logger configuration options
type Logger ¶
type Logger struct {
*zap.SugaredLogger
// contains filtered or unexported fields
}
Logger wraps zap.SugaredLogger to provide structured logging throughout the application
func WithDocumentID ¶
WithDocumentID returns a logger with document_id field attached
func WithFields ¶
func WithFields(fields ...interface{}) *Logger
WithFields returns a logger with the specified fields attached
func WithOperation ¶
WithOperation returns a logger with operation field attached
func (*Logger) WithDocumentID ¶
WithDocumentID returns a logger with document_id field attached
func (*Logger) WithFields ¶
WithFields returns a logger with the specified fields attached for structured logging
func (*Logger) WithOperation ¶
WithOperation returns a logger with operation field attached