Versions in this module Expand all Collapse all v0 v0.0.1 Mar 26, 2026 Changes in this version + const ContextKeyInstance + var ErrValidationFailed = errors.New("validation failed") + func GenerateOperationID(component string) string + func WithComponent(ctx context.Context, component string) context.Context + func WithFields(ctx context.Context, fields Fields) context.Context + func WithLogger(ctx context.Context, logger Logger) context.Context + func WithOperationID(ctx context.Context, operationID string) context.Context + type Config struct + EnableColors bool + Format Format + Level LogLevel + Output io.Writer + TimeFormat string + func DefaultConfig() Config + func (c Config) Validate() error + type Fields map[string]any + type Format string + const FormatHuman + const FormatJSON + type Formatter interface + Format func(entry *LogEntry, writer io.Writer) error + Name func() string + type HumanFormatter struct + func NewHumanFormatter(enableColors bool, timeFormat string) *HumanFormatter + func (f *HumanFormatter) Format(entry *LogEntry, writer io.Writer) error + func (f *HumanFormatter) Name() string + type JSONFormatter struct + func NewJSONFormatter(timeFormat string) *JSONFormatter + func (f *JSONFormatter) Format(entry *LogEntry, writer io.Writer) error + func (f *JSONFormatter) Name() string + type LogContext struct + Component string + Fields map[string]any + OperationID string + type LogEntry struct + Component string + Error error + Fields map[string]any + Level LogLevel + Message string + OperationID string + Timestamp time.Time + type LogLevel int + const LogLevelDebug + const LogLevelError + const LogLevelFatal + const LogLevelInfo + const LogLevelWarn + func (l LogLevel) MarshalText() ([]byte, error) + func (l LogLevel) String() string + type Logger interface + Close func() error + Debug func(ctx context.Context, message string, fields ...Fields) + Error func(ctx context.Context, message string, err error, fields ...Fields) + Fatal func(ctx context.Context, message string, err error, fields ...Fields) + Flush func() error + Info func(ctx context.Context, message string, fields ...Fields) + SetFormatter func(formatter Formatter) + SetLevel func(level LogLevel) + Warn func(ctx context.Context, message string, fields ...Fields) + WithComponent func(component string) Logger + WithContext func(component string, operationID string, fields ...Fields) Logger + func GetLogger(ctx context.Context) Logger + func New(config Config) (Logger, error) + func NewDefault() Logger