Versions in this module Expand all Collapse all v0 v0.0.7 Mar 16, 2026 Changes in this version + func IntoContext(ctx context.Context, logger *Logger) context.Context + func SetDefaultLogger(logger *Logger) + type AccessLogEntry struct + ClientIP string + Env string + Hostname string + Latency time.Duration + LatencyMS int64 + Level Level + LogType string + Method string + PanicRecovered bool + Path string + Referer string + RequestBytes int64 + RequestErrors []string + RequestFields map[string]interface{} + RequestID string + RequestLogTruncated bool + RequestMessages []string + ResponseBytes int64 + Route string + Service string + SpanID string + StatusCode int + Timestamp time.Time + TraceID string + UserAgent string + Version string + type Config struct + AccessWriter io.Writer + AddCaller bool + AppWriter io.Writer + Env string + ErrorWriter io.Writer + Format Format + Hostname string + Level Level + Observer Observer + Redactor Redactor + Sampling SamplingConfig + Service string + StaticFields []Field + TimeZone *time.Location + Version string + type Field struct + func AnyField(key string, value interface{}) Field + func BoolField(key string, value bool) Field + func DurationField(key string, value time.Duration) Field + func ErrorField(err error) Field + func Int64Field(key string, value int64) Field + func IntField(key string, value int) Field + func StringField(key, value string) Field + func StringSliceField(key string, value []string) Field + func TimeField(key string, value time.Time) Field + type Format uint8 + const AutoFormat + const ConsoleFormat + const JSONFormat + func ParseFormat(format string) (Format, error) + func (f Format) String() string + type Level uint8 + const DebugLevel + const ErrorLevel + const FatalLevel + const InfoLevel + const UnspecifiedLevel + const WarnLevel + func ParseLevel(level string) (Level, error) + func (l Level) String() string + type Logger struct + func DefaultLogger() *Logger + func FromContext(ctx context.Context) *Logger + func MustFromContext(ctx context.Context) *Logger + func MustNewLogger(config Config) *Logger + func NewLogger(config Config) (*Logger, error) + func (l *Logger) AppendRequestLogError(err error) + func (l *Logger) AppendRequestLogField(key string, value interface{}) + func (l *Logger) AppendRequestLogFields(fields ...Field) + func (l *Logger) AppendRequestLogMessage(message string) + func (l *Logger) Debug(message string, fields ...Field) + func (l *Logger) Error(message string, fields ...Field) + func (l *Logger) Fatal(message string, fields ...Field) + func (l *Logger) Info(message string, fields ...Field) + func (l *Logger) OverrideRequestLogLevel(level Level) + func (l *Logger) Sync() error + func (l *Logger) Warn(message string, fields ...Field) + func (l *Logger) WithComponent(component string) *Logger + func (l *Logger) WithFields(fields ...Field) *Logger + func (l *Logger) WithName(name string) *Logger + func (l *Logger) WithRequestLogAccumulator(accumulator *RequestLogAccumulator) *Logger + func (l *Logger) WriteAccessLog(entry AccessLogEntry) + type Observer interface + ObserveAccessLog func(level Level, statusCode int, route string, latency time.Duration) + ObserveAppLog func(level Level, logType string) + func NopObserver() Observer + type Redactor interface + RedactField func(key string, value interface{}) interface{} + func DefaultRedactor() Redactor + type RequestLogAccumulator struct + func NewRequestLogAccumulator(limits RequestLogLimits) *RequestLogAccumulator + type RequestLogLimits struct + MaxErrorCount int + MaxFieldCount int + MaxMessageCount int + type SamplingConfig struct + DisableForAccess bool + DisableForError bool + Enabled bool + First int + Interval time.Duration + Thereafter int