Documentation
¶
Index ¶
- Variables
- func InitLogger(config LoggerConfig) error
- func LogDebug(message string, fields map[string]interface{})
- func LogError(message string, err error, fields map[string]interface{})
- func LogFatal(message string, fields map[string]interface{})
- func LogInfo(message string, fields map[string]interface{})
- func LogWarn(message string, fields map[string]interface{})
- func SimpleInitLogger(debug bool, logFormat string)
- func Sync() error
- func WithError(err error) *zap.SugaredLogger
- func WithField(key string, value interface{}) *zap.SugaredLogger
- func WithFields(fields map[string]interface{}) *zap.SugaredLogger
- type LoggerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *zap.SugaredLogger
Global logger instance
Functions ¶
func InitLogger ¶
func InitLogger(config LoggerConfig) error
InitLogger initializes the logger with the provided configuration
func SimpleInitLogger ¶
SimpleInitLogger provides backward compatibility with the old init function
func WithError ¶
func WithError(err error) *zap.SugaredLogger
WithError returns a logger with an error field added to every log
func WithField ¶
func WithField(key string, value interface{}) *zap.SugaredLogger
WithField returns a logger with a field added to every log
func WithFields ¶
func WithFields(fields map[string]interface{}) *zap.SugaredLogger
WithFields returns a logger with multiple fields added to every log
Types ¶
type LoggerConfig ¶
type LoggerConfig struct { Debug bool // Enable debug level logging LogFormat string // "json" or "human" LogFile string // Path to log file (optional) }
LoggerConfig contains configuration for the logger
func DefaultConfig ¶
func DefaultConfig() LoggerConfig
DefaultConfig returns a default configuration
Click to show internal directories.
Click to hide internal directories.