Documentation ¶
Index ¶
- func CLIConfig(level log.Level) zap.Config
- func ConsoleConfig(level log.Level) zap.Config
- func Context(ctx context.Context) zap.Field
- func JSONConfig(level log.Level) zap.Config
- func KVConfig(level log.Level) zap.Config
- func LazyCall(key string, fn any) zap.Field
- func NewDeployConfig(opts ...cfgOption) zap.Config
- func NewDeployEncoderConfig() zapcore.EncoderConfig
- func NewProductionDeployConfig() zap.Config
- func SetOutputPaths(paths []string) cfgOption
- func StandardConfig(encoding string, level log.Level) zap.Config
- func TSKVConfig(level log.Level) zap.Config
- func UnzapifyLevel(level zapcore.Level) log.Level
- func WithDevelopment(enabled bool) cfgOption
- func WithLevel(level log.Level) cfgOption
- func WithSampling(initial int, thereafter int) cfgOption
- func ZapifyLevel(level log.Level) zapcore.Level
- type Logger
- func Must(cfg zap.Config) *Logger
- func New(cfg zap.Config) (*Logger, error)
- func NewCustomDeployLogger(cfg zap.Config, opts ...zap.Option) (*Logger, error)
- func NewDeployLogger(level log.Level, opts ...zap.Option) (*Logger, error)
- func NewProductionDeployLogger(level log.Level, opts ...zap.Option) (*Logger, error)
- func NewQloudLogger(level log.Level, opts ...zap.Option) (*Logger, error)
- func NewWithCore(core zapcore.Core, options ...zap.Option) *Logger
- func (l *Logger) AddCallerSkip(skip int) log.Logger
- func (l *Logger) Debug(msg string, fields ...log.Field)
- func (l *Logger) Debugf(msg string, args ...interface{})
- func (l *Logger) Error(msg string, fields ...log.Field)
- func (l *Logger) Errorf(msg string, args ...interface{})
- func (l *Logger) Fatal(msg string, fields ...log.Field)
- func (l *Logger) Fatalf(msg string, args ...interface{})
- func (l *Logger) Fmt() log.Fmt
- func (l *Logger) Info(msg string, fields ...log.Field)
- func (l *Logger) Infof(msg string, args ...interface{})
- func (l *Logger) Logger() log.Logger
- func (l *Logger) Structured() log.Structured
- func (l *Logger) Trace(msg string, fields ...log.Field)
- func (l *Logger) Tracef(msg string, args ...interface{})
- func (l *Logger) Warn(msg string, fields ...log.Field)
- func (l *Logger) Warnf(msg string, args ...interface{})
- func (l *Logger) With(fields ...log.Field) log.Logger
- func (l *Logger) WithName(name string) log.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsoleConfig ¶
ConsoleConfig returns zap config for logging to console (zap's console encoder)
func Context ¶ added in v0.0.4
Context creates a log field from context - all fields bound with ctxlog.WithFields will be added.
func JSONConfig ¶
JSONConfig returns zap config for structured logging (zap's json encoder)
func NewDeployConfig ¶
NewDeployConfig returns default configuration (with no sampling). Not recommended for production use.
func NewDeployEncoderConfig ¶
func NewDeployEncoderConfig() zapcore.EncoderConfig
NewDeployEncoderConfig returns an opinionated EncoderConfig for deploy environment.
func NewProductionDeployConfig ¶
NewProductionDeployConfig returns configuration, suitable for production use.
It uses a JSON encoder, writes to standard error, and enables sampling. Stacktraces are automatically included on logs of ErrorLevel and above.
func SetOutputPaths ¶ added in v0.0.3
func SetOutputPaths(paths []string) cfgOption
SetOutputPaths sets OutputPaths (stdout by default)
func StandardConfig ¶
StandardConfig returns default zap config with specified encoding and level
func TSKVConfig ¶
TSKVConfig returns zap config for logging to tskv (custom tskv encoder)
func UnzapifyLevel ¶
UnzapifyLevel turns zap log level to interface log level.
func WithDevelopment ¶ added in v0.0.3
func WithDevelopment(enabled bool) cfgOption
WithDevelopment sets Development option of zap.Config
func WithSampling ¶ added in v0.0.3
WithSampling sets sampling settings initial and thereafter
Types ¶
type Logger ¶
Logger implements log.Logger interface
func NewCustomDeployLogger ¶ added in v0.0.3
NewCustomDeployLogger constructs new logger by config cfg
func NewDeployLogger ¶
NewDeployLogger constructs fully-fledged Deploy compatible logger based on predefined config. See https://deploy.yandex-team.ru/docs/concepts/pod/sidecars/logs/logs#format for more information
func NewProductionDeployLogger ¶
Same as NewDeployLogger, but with sampling
func NewQloudLogger ¶
NewQloudLogger constructs fully-fledged Qloud compatible logger based on predefined config. See https://wiki.yandex-team.ru/qloud/doc/logs for more information
func NewWithCore ¶
NewWithCore constructs zap-based logger from provided core
func (*Logger) Structured ¶
func (l *Logger) Structured() log.Structured
Structured returns structured logger