Documentation
¶
Index ¶
- func Debug(msg string, kvs ...any)
- func EnsureInitialized()
- func Error(msg string, kvs ...any)
- func Fatal(msg string, kvs ...any)
- func Info(msg string, kvs ...any)
- func Init(driver string, config map[string]any) error
- func Warn(msg string, kvs ...any)
- type Level
- type Logger
- type Manager
- type NullLogger
- type StackLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureInitialized ¶
func EnsureInitialized()
EnsureInitialized can be called explicitly to guarantee logger initialization, though the logger auto-initializes on first use through the init() function
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, kvs ...any)
Info(msg string, kvs ...any)
Warn(msg string, kvs ...any)
Error(msg string, kvs ...any)
Fatal(msg string, kvs ...any)
}
Logger defines the interface for all log implementations
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles multiple logger channels for advanced logging scenarios. Each channel can have its own driver configuration (file, console, stack, null)
func NewManager ¶
func NewManager(cfg config.LoggingConfig) *Manager
NewManager creates a new logger manager with the given configuration. The manager allows different log channels with independent drivers and settings
type NullLogger ¶
type NullLogger struct{}
NullLogger discards all log messages without any output. Useful for testing or disabling logging for specific channels
func NewNullLogger ¶
func NewNullLogger() *NullLogger
NewNullLogger creates a logger that silently discards all messages. No output is produced regardless of log level
func (*NullLogger) Debug ¶
func (n *NullLogger) Debug(msg string, kvs ...any)
func (*NullLogger) Error ¶
func (n *NullLogger) Error(msg string, kvs ...any)
func (*NullLogger) Fatal ¶
func (n *NullLogger) Fatal(msg string, kvs ...any)
func (*NullLogger) Info ¶
func (n *NullLogger) Info(msg string, kvs ...any)
func (*NullLogger) Warn ¶
func (n *NullLogger) Warn(msg string, kvs ...any)
type StackLogger ¶
type StackLogger struct {
// contains filtered or unexported fields
}
StackLogger logs to multiple loggers simultaneously. Useful for logging to multiple destinations (e.g., file and console)
func NewStackLogger ¶
func NewStackLogger(loggers ...Logger) *StackLogger
NewStackLogger creates a logger that writes to multiple loggers. All provided loggers will receive the same log messages
func (*StackLogger) Debug ¶
func (s *StackLogger) Debug(msg string, kvs ...any)
Debug logs a debug message to all configured loggers
func (*StackLogger) Error ¶
func (s *StackLogger) Error(msg string, kvs ...any)
Error logs an error message to all configured loggers
func (*StackLogger) Fatal ¶
func (s *StackLogger) Fatal(msg string, kvs ...any)
Fatal logs a fatal message to all configured loggers
func (*StackLogger) Info ¶
func (s *StackLogger) Info(msg string, kvs ...any)
Info logs an info message to all configured loggers
func (*StackLogger) Warn ¶
func (s *StackLogger) Warn(msg string, kvs ...any)
Warn logs a warning message to all configured loggers