Documentation ¶
Index ¶
- func BoolSlice[T ~bool](s []T) zapcore.ArrayMarshaler
- func ByteStringSlice[T ~[]byte](s []T) zapcore.ArrayMarshaler
- func Complex128Slice[T ~complex128](s []T) zapcore.ArrayMarshaler
- func Complex64Slice[T ~complex64](s []T) zapcore.ArrayMarshaler
- func Debugw(msg string, keysAndValues ...any)
- func DurationSlice(s []time.Duration) zapcore.ArrayMarshaler
- func Errorw(msg string, err error, keysAndValues ...any)
- func Float32Slice[T ~float32](s []T) zapcore.ArrayMarshaler
- func Float64Slice[T ~float64](s []T) zapcore.ArrayMarshaler
- func Infow(msg string, keysAndValues ...any)
- func InitFromConfig(conf *Config, name string)
- func Int16Slice[T ~int16](s []T) zapcore.ArrayMarshaler
- func Int32Slice[T ~int32](s []T) zapcore.ArrayMarshaler
- func Int64Slice[T ~int64](s []T) zapcore.ArrayMarshaler
- func Int8Slice[T ~int8](s []T) zapcore.ArrayMarshaler
- func IntSlice[T ~int](s []T) zapcore.ArrayMarshaler
- func NewSlogDiscard() slog.Handler
- func ObjectSlice[T zapcore.ObjectMarshaler](s []T) zapcore.ArrayMarshaler
- func ParseZapLevel(level string) zapcore.Level
- func Proto(val proto.Message) zapcore.ObjectMarshaler
- func ProtoSlice[T proto.Message](s []T) zapcore.ArrayMarshaler
- func SetLogger(l Logger, name string)
- func StringSlice[T ~string](s []T) zapcore.ArrayMarshaler
- func TimeSlice(s []time.Time) zapcore.ArrayMarshaler
- func ToSlogHandler(log Logger) slog.Handler
- func Uint16Slice[T ~uint16](s []T) zapcore.ArrayMarshaler
- func Uint32Slice[T ~uint32](s []T) zapcore.ArrayMarshaler
- func Uint64Slice[T ~uint64](s []T) zapcore.ArrayMarshaler
- func Uint8Slice[T ~uint8](s []T) zapcore.ArrayMarshaler
- func UintSlice[T ~uint](s []T) zapcore.ArrayMarshaler
- func UintptrSlice[T ~uintptr](s []T) zapcore.ArrayMarshaler
- func Warnw(msg string, err error, keysAndValues ...any)
- type Config
- type ConfigObserver
- type DeferredFieldResolver
- type LogRLogger
- func (l LogRLogger) Debugw(msg string, keysAndValues ...any)
- func (l LogRLogger) Errorw(msg string, err error, keysAndValues ...any)
- func (l LogRLogger) Infow(msg string, keysAndValues ...any)
- func (l LogRLogger) Warnw(msg string, err error, keysAndValues ...any)
- func (l LogRLogger) WithCallDepth(depth int) Logger
- func (l LogRLogger) WithComponent(component string) Logger
- func (l LogRLogger) WithDeferredValues() (Logger, DeferredFieldResolver)
- func (l LogRLogger) WithItemSampler() Logger
- func (l LogRLogger) WithName(name string) Logger
- func (l LogRLogger) WithUnlikelyValues(keysAndValues ...any) UnlikelyLogger
- func (l LogRLogger) WithValues(keysAndValues ...any) Logger
- func (l LogRLogger) WithoutSampler() Logger
- type Logger
- type UnlikelyLogger
- func (l UnlikelyLogger) Debugw(msg string, keysAndValues ...any)
- func (l UnlikelyLogger) Errorw(msg string, err error, keysAndValues ...any)
- func (l UnlikelyLogger) Infow(msg string, keysAndValues ...any)
- func (l UnlikelyLogger) Warnw(msg string, err error, keysAndValues ...any)
- func (l UnlikelyLogger) WithValues(keysAndValues ...any) UnlikelyLogger
- type ZapComponentLeveler
- type ZapLogger
- type ZapLoggerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolSlice ¶
func BoolSlice[T ~bool](s []T) zapcore.ArrayMarshaler
func ByteStringSlice ¶
func ByteStringSlice[T ~[]byte](s []T) zapcore.ArrayMarshaler
func Complex128Slice ¶
func Complex128Slice[T ~complex128](s []T) zapcore.ArrayMarshaler
func Complex64Slice ¶
func Complex64Slice[T ~complex64](s []T) zapcore.ArrayMarshaler
func DurationSlice ¶
func DurationSlice(s []time.Duration) zapcore.ArrayMarshaler
func Float32Slice ¶
func Float32Slice[T ~float32](s []T) zapcore.ArrayMarshaler
func Float64Slice ¶
func Float64Slice[T ~float64](s []T) zapcore.ArrayMarshaler
func InitFromConfig ¶
InitFromConfig initializes a Zap-based logger
func Int16Slice ¶
func Int16Slice[T ~int16](s []T) zapcore.ArrayMarshaler
func Int32Slice ¶
func Int32Slice[T ~int32](s []T) zapcore.ArrayMarshaler
func Int64Slice ¶
func Int64Slice[T ~int64](s []T) zapcore.ArrayMarshaler
func Int8Slice ¶
func Int8Slice[T ~int8](s []T) zapcore.ArrayMarshaler
func IntSlice ¶
func IntSlice[T ~int](s []T) zapcore.ArrayMarshaler
func NewSlogDiscard ¶
NewSlogDiscard creates a slog.Handler that discards all logs.
func ObjectSlice ¶
func ObjectSlice[T zapcore.ObjectMarshaler](s []T) zapcore.ArrayMarshaler
func ParseZapLevel ¶
func ProtoSlice ¶
func ProtoSlice[T proto.Message](s []T) zapcore.ArrayMarshaler
func StringSlice ¶
func StringSlice[T ~string](s []T) zapcore.ArrayMarshaler
func ToSlogHandler ¶
ToSlogHandler converts Logger to slog.Handler.
func Uint16Slice ¶
func Uint16Slice[T ~uint16](s []T) zapcore.ArrayMarshaler
func Uint32Slice ¶
func Uint32Slice[T ~uint32](s []T) zapcore.ArrayMarshaler
func Uint64Slice ¶
func Uint64Slice[T ~uint64](s []T) zapcore.ArrayMarshaler
func Uint8Slice ¶
func Uint8Slice[T ~uint8](s []T) zapcore.ArrayMarshaler
func UintSlice ¶
func UintSlice[T ~uint](s []T) zapcore.ArrayMarshaler
func UintptrSlice ¶
func UintptrSlice[T ~uintptr](s []T) zapcore.ArrayMarshaler
Types ¶
type Config ¶
type Config struct { JSON bool `yaml:"json,omitempty"` Level string `yaml:"level,omitempty"` // true to enable log sampling, where the same log message and level will be throttled. // we have two layers of sampling // 1. global sampling - within a second, it will log the first SampleInitial, then every SampleInterval messages. // 2. per participant/track sampling - to be used with Logger.WithItemSampler(). This would be used to throttle // the logs for a particular participant/track. Sample bool `yaml:"sample,omitempty"` ComponentLevels map[string]string `yaml:"component_levels,omitempty"` // global sampling per server // when sampling, the first N logs will be logged SampleInitial int `yaml:"sample_initial,omitempty"` // when sampling, every Mth log will be logged SampleInterval int `yaml:"sample_interval,omitempty"` // participant/track level sampling ItemSampleSeconds int `yaml:"item_sample_seconds,omitempty"` ItemSampleInitial int `yaml:"item_sample_initial,omitempty"` ItemSampleInterval int `yaml:"item_sample_interval,omitempty"` // contains filtered or unexported fields }
func (*Config) AddUpdateObserver ¶
func (c *Config) AddUpdateObserver(cb ConfigObserver)
type ConfigObserver ¶
type DeferredFieldResolver ¶
type DeferredFieldResolver = zaputil.DeferredFieldResolver
type LogRLogger ¶
func (LogRLogger) Debugw ¶
func (l LogRLogger) Debugw(msg string, keysAndValues ...any)
func (LogRLogger) Infow ¶
func (l LogRLogger) Infow(msg string, keysAndValues ...any)
func (LogRLogger) WithCallDepth ¶
func (l LogRLogger) WithCallDepth(depth int) Logger
func (LogRLogger) WithComponent ¶
func (l LogRLogger) WithComponent(component string) Logger
func (LogRLogger) WithDeferredValues ¶
func (l LogRLogger) WithDeferredValues() (Logger, DeferredFieldResolver)
func (LogRLogger) WithItemSampler ¶
func (l LogRLogger) WithItemSampler() Logger
func (LogRLogger) WithName ¶
func (l LogRLogger) WithName(name string) Logger
func (LogRLogger) WithUnlikelyValues ¶
func (l LogRLogger) WithUnlikelyValues(keysAndValues ...any) UnlikelyLogger
func (LogRLogger) WithValues ¶
func (l LogRLogger) WithValues(keysAndValues ...any) Logger
func (LogRLogger) WithoutSampler ¶
func (l LogRLogger) WithoutSampler() Logger
type Logger ¶
type Logger interface { Debugw(msg string, keysAndValues ...any) Infow(msg string, keysAndValues ...any) Warnw(msg string, err error, keysAndValues ...any) Errorw(msg string, err error, keysAndValues ...any) WithValues(keysAndValues ...any) Logger WithUnlikelyValues(keysAndValues ...any) UnlikelyLogger WithName(name string) Logger // WithComponent creates a new logger with name as "<name>.<component>", and uses a log level as specified WithComponent(component string) Logger WithCallDepth(depth int) Logger WithItemSampler() Logger // WithoutSampler returns the original logger without sampling WithoutSampler() Logger WithDeferredValues() (Logger, DeferredFieldResolver) }
type UnlikelyLogger ¶
type UnlikelyLogger struct {
// contains filtered or unexported fields
}
func (UnlikelyLogger) Debugw ¶
func (l UnlikelyLogger) Debugw(msg string, keysAndValues ...any)
func (UnlikelyLogger) Errorw ¶
func (l UnlikelyLogger) Errorw(msg string, err error, keysAndValues ...any)
func (UnlikelyLogger) Infow ¶
func (l UnlikelyLogger) Infow(msg string, keysAndValues ...any)
func (UnlikelyLogger) Warnw ¶
func (l UnlikelyLogger) Warnw(msg string, err error, keysAndValues ...any)
func (UnlikelyLogger) WithValues ¶
func (l UnlikelyLogger) WithValues(keysAndValues ...any) UnlikelyLogger
type ZapComponentLeveler ¶
type ZapComponentLeveler interface {
ComponentLevel(component string) zapcore.LevelEnabler
}
type ZapLogger ¶
type ZapLogger interface { Logger ToZap() *zap.SugaredLogger ComponentLeveler() ZapComponentLeveler WithMinLevel(lvl zapcore.LevelEnabler) Logger }
func FromZapLogger ¶
func NewZapLogger ¶
func NewZapLogger(conf *Config, opts ...ZapLoggerOption) (ZapLogger, error)
type ZapLoggerOption ¶
type ZapLoggerOption func(*zapConfig)
func WithTap ¶
func WithTap(tap *zaputil.WriteEnabler) ZapLoggerOption
Click to show internal directories.
Click to hide internal directories.