Documentation
¶
Index ¶
- Variables
- func ProvideLogger(config interfaces.Config) (interfaces.Logger, error)
- type LoggerFactory
- type LoggingConfig
- type LogrusLogger
- func (l *LogrusLogger) Debug(msg string)
- func (l *LogrusLogger) Debugf(format string, args ...interface{})
- func (l *LogrusLogger) Error(msg string)
- func (l *LogrusLogger) Errorf(format string, args ...interface{})
- func (l *LogrusLogger) Fatal(msg string)
- func (l *LogrusLogger) Fatalf(format string, args ...interface{})
- func (l *LogrusLogger) GetLevel() constants.Level
- func (l *LogrusLogger) GetLoggerKind() constants.LoggerKind
- func (l *LogrusLogger) Info(msg string)
- func (l *LogrusLogger) Infof(format string, args ...interface{})
- func (l *LogrusLogger) SetLevel(level constants.Level)
- func (l *LogrusLogger) Warn(msg string)
- func (l *LogrusLogger) Warnf(format string, args ...interface{})
- type SlogLogger
- func (l *SlogLogger) Debug(msg string)
- func (l *SlogLogger) Debugf(format string, args ...any)
- func (l *SlogLogger) Error(msg string)
- func (l *SlogLogger) Errorf(format string, args ...any)
- func (l *SlogLogger) Fatal(msg string)
- func (l *SlogLogger) Fatalf(format string, args ...any)
- func (l *SlogLogger) GetLevel() constants.Level
- func (l *SlogLogger) GetLoggerKind() constants.LoggerKind
- func (l *SlogLogger) Info(msg string)
- func (l *SlogLogger) Infof(format string, args ...any)
- func (l *SlogLogger) SetLevel(level constants.Level)
- func (l *SlogLogger) Warn(msg string)
- func (l *SlogLogger) Warnf(format string, args ...any)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedLoggerKind is returned when an unsupported logger Kind is specified. ErrUnsupportedLoggerKind = errors.New("unsupported logger kind") // ErrInvalidLogLevel is returned when an invalid log level is specified. ErrInvalidLogLevel = errors.New("invalid log level") // ErrInvalidLogger is returned when an invalid logger is specified. ErrInvalidLogger = errors.New("invalid logger") // ErrLoggingConfigNotFound is returned when a logging config is not found. ErrLoggingConfigNotFound = errors.New("logging config not found") )
var Set = wire.NewSet( NewLoggerFactory, ProvideLogger, )
Functions ¶
func ProvideLogger ¶
func ProvideLogger(config interfaces.Config) (interfaces.Logger, error)
Types ¶
type LoggerFactory ¶
type LoggerFactory struct {
// contains filtered or unexported fields
}
func NewLoggerFactory ¶
func NewLoggerFactory(config interfaces.Config) (*LoggerFactory, error)
NewLoggerFactory creates a new instance of LoggerFactory.
func (*LoggerFactory) GetLogger ¶
func (b *LoggerFactory) GetLogger() (interfaces.Logger, error)
GetLogger provides a logger based on the configuration.
func (*LoggerFactory) GetLoggerConfig ¶
func (b *LoggerFactory) GetLoggerConfig() interfaces.LoggingConfig
type LoggingConfig ¶
type LoggingConfig struct {
// Level is the logging level.
Level constants.Level `mapstructure:"level" json:"level"`
// Kind is the logger Kind.
LoggerKind constants.LoggerKind `mapstructure:"kind" json:"kind"`
}
LoggingConfig represents the logging configuration.
func (*LoggingConfig) GetLevel ¶
func (l *LoggingConfig) GetLevel() constants.Level
GetLevel returns the logging level.
func (*LoggingConfig) GetLoggerKind ¶
func (l *LoggingConfig) GetLoggerKind() constants.LoggerKind
GetLoggerKind returns the logger Kind.
type LogrusLogger ¶
LogrusLogger is a logger implementation using logrus.
func NewLogrusLogger ¶
func NewLogrusLogger(config interfaces.LoggingConfig) *LogrusLogger
NewLogrusLogger creates a new instance of LogrusLogger.
func (*LogrusLogger) Debug ¶
func (l *LogrusLogger) Debug(msg string)
Debug logs a message at the debug level.
func (*LogrusLogger) Debugf ¶
func (l *LogrusLogger) Debugf(format string, args ...interface{})
Debugf logs a formatted message at the debug level.
func (*LogrusLogger) Error ¶
func (l *LogrusLogger) Error(msg string)
Error logs a message at the error level.
func (*LogrusLogger) Errorf ¶
func (l *LogrusLogger) Errorf(format string, args ...interface{})
Errorf logs a formatted message at the error level.
func (*LogrusLogger) Fatal ¶
func (l *LogrusLogger) Fatal(msg string)
Fatal logs a message at the fatal level.
func (*LogrusLogger) Fatalf ¶
func (l *LogrusLogger) Fatalf(format string, args ...interface{})
Fatalf logs a formatted message at the fatal level.
func (*LogrusLogger) GetLevel ¶
func (l *LogrusLogger) GetLevel() constants.Level
GetLevel returns the logging level.
func (*LogrusLogger) GetLoggerKind ¶
func (l *LogrusLogger) GetLoggerKind() constants.LoggerKind
GetLoggerKind returns the logger Kind.
func (*LogrusLogger) Info ¶
func (l *LogrusLogger) Info(msg string)
Info logs a message at the info level.
func (*LogrusLogger) Infof ¶
func (l *LogrusLogger) Infof(format string, args ...interface{})
Infof logs a formatted message at the info level.
func (*LogrusLogger) SetLevel ¶
func (l *LogrusLogger) SetLevel(level constants.Level)
SetLevel sets the logging level.
func (*LogrusLogger) Warn ¶
func (l *LogrusLogger) Warn(msg string)
Warn logs a message at the warn level.
func (*LogrusLogger) Warnf ¶
func (l *LogrusLogger) Warnf(format string, args ...interface{})
Warnf logs a formatted message at the warn level.
type SlogLogger ¶
SlogLogger is a logger that logs to slog.
func NewSlogLogger ¶
func NewSlogLogger(config interfaces.LoggingConfig) *SlogLogger
NewSlogLogger creates a new SlogLogger.
func (*SlogLogger) Debug ¶
func (l *SlogLogger) Debug(msg string)
Debug logs a message at the debug level.
func (*SlogLogger) Debugf ¶
func (l *SlogLogger) Debugf(format string, args ...any)
Debugf logs a formatted message at the debug level.
func (*SlogLogger) Error ¶
func (l *SlogLogger) Error(msg string)
Error logs a message at the error level.
func (*SlogLogger) Errorf ¶
func (l *SlogLogger) Errorf(format string, args ...any)
Errorf logs a formatted message at the error level.
func (*SlogLogger) Fatal ¶
func (l *SlogLogger) Fatal(msg string)
Fatal logs a message at the fatal level.
func (*SlogLogger) Fatalf ¶
func (l *SlogLogger) Fatalf(format string, args ...any)
Fatalf logs a formatted message at the fatal level.
func (*SlogLogger) GetLevel ¶
func (l *SlogLogger) GetLevel() constants.Level
GetLevel returns the logging level.
func (*SlogLogger) GetLoggerKind ¶
func (l *SlogLogger) GetLoggerKind() constants.LoggerKind
GetLoggerKind returns the logger Kind.
func (*SlogLogger) Info ¶
func (l *SlogLogger) Info(msg string)
Info logs a message at the info level.
func (*SlogLogger) Infof ¶
func (l *SlogLogger) Infof(format string, args ...any)
Infof logs a formatted message at the info level.
func (*SlogLogger) SetLevel ¶
func (l *SlogLogger) SetLevel(level constants.Level)
SetLevel sets the logging level.
func (*SlogLogger) Warn ¶
func (l *SlogLogger) Warn(msg string)
Warn logs a message at the warn level.
func (*SlogLogger) Warnf ¶
func (l *SlogLogger) Warnf(format string, args ...any)
Warnf logs a formatted message at the warn level.