Documentation ¶
Overview ¶
Package logger provides logging functionality for the application
Index ¶
- type KeyVal
- type Logger
- type SlogLogger
- func (l *SlogLogger) Close() error
- func (l *SlogLogger) Debug(ctx context.Context, msg string, args ...KeyVal)
- func (l *SlogLogger) Error(ctx context.Context, msg string, args ...KeyVal)
- func (l *SlogLogger) Info(ctx context.Context, msg string, args ...KeyVal)
- func (l *SlogLogger) SetupLogger(env string, cfg config.ValidLoggingConfig) error
- func (l *SlogLogger) Warn(ctx context.Context, msg string, args ...KeyVal)
- func (l *SlogLogger) With(args ...KeyVal) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyVal ¶
KeyVal is a key value pair
type Logger ¶
type Logger interface { SetupLogger(env string, conf config.ValidLoggingConfig) error With(args ...KeyVal) Logger Debug(ctx context.Context, msg string, args ...KeyVal) Info(ctx context.Context, msg string, args ...KeyVal) Warn(ctx context.Context, msg string, args ...KeyVal) Error(ctx context.Context, msg string, args ...KeyVal) Close() error }
Logger is an interface for logging
func NewLoggerFromConfig ¶
func NewLoggerFromConfig(_ string, _ config.ValidLoggingConfig) (Logger, error)
NewLoggerFromConfig creates a new Logger from the config
type SlogLogger ¶
SlogLogger is a logger that uses slog
func (*SlogLogger) Debug ¶
func (l *SlogLogger) Debug(ctx context.Context, msg string, args ...KeyVal)
Debug logs a debug message
func (*SlogLogger) Error ¶
func (l *SlogLogger) Error(ctx context.Context, msg string, args ...KeyVal)
Error logs an error message
func (*SlogLogger) Info ¶
func (l *SlogLogger) Info(ctx context.Context, msg string, args ...KeyVal)
Info logs an info message
func (*SlogLogger) SetupLogger ¶
func (l *SlogLogger) SetupLogger(env string, cfg config.ValidLoggingConfig) error
SetupLogger sets up the logger with the given configuration
func (*SlogLogger) Warn ¶
func (l *SlogLogger) Warn(ctx context.Context, msg string, args ...KeyVal)
Warn logs a warning message
func (*SlogLogger) With ¶
func (l *SlogLogger) With(args ...KeyVal) Logger
With adds attributes to the logger
Click to show internal directories.
Click to hide internal directories.