Documentation
¶
Overview ¶
Package log provides structured logging using zerolog. It wraps zerolog to provide a clean API for application-wide logging.
Index ¶
- func Debug(msg string)
- func Debugf(format string, args ...interface{})
- func Error(msg string)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string)
- func Fatalf(format string, args ...interface{})
- func Info(msg string)
- func Infof(format string, args ...interface{})
- func InitLogger(w io.Writer, level zerolog.Level, pretty bool)
- func ParseLevel(level string) zerolog.Level
- func SetGlobalLevel(level zerolog.Level)
- func SetGlobalLogger(logger *Logger)
- func Warn(msg string)
- func Warnf(format string, args ...interface{})
- type Logger
- func (l *Logger) Debug(msg string)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(msg string)
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(msg string)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) GetZerolog() *zerolog.Logger
- func (l *Logger) Info(msg string)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Warn(msg string)
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) With() *Logger
- func (l *Logger) WithError(err error) *Logger
- func (l *Logger) WithField(key string, value interface{}) *Logger
- func (l *Logger) WithFields(fields map[string]interface{}) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a formatted message at debug level using the global logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a formatted message at error level using the global logger.
func Fatal ¶
func Fatal(msg string)
Fatal logs a message at fatal level and exits using the global logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a formatted message at fatal level and exits using the global logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a formatted message at info level using the global logger.
func InitLogger ¶
InitLogger initializes the global logger with specific configuration. This should be called at application startup.
func ParseLevel ¶
ParseLevel converts a string level to zerolog.Level.
func SetGlobalLevel ¶
SetGlobalLevel sets the global logging level.
func SetGlobalLogger ¶
func SetGlobalLogger(logger *Logger)
SetGlobalLogger sets the global logger instance.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps zerolog.Logger with application-specific methods.
func NewWithLevel ¶
NewWithLevel creates a new Logger with a specific log level.
func WithFields ¶
WithFields creates a logger with multiple fields using the global logger.
func (*Logger) GetZerolog ¶
GetZerolog returns the underlying zerolog.Logger for advanced usage.
func (*Logger) WithFields ¶
WithFields adds multiple fields to the logger context.