Documentation
¶
Index ¶
- type Config
- type ExtendedLogger
- type LogFormat
- type LogLevel
- type Logger
- type Option
- func WithAppName(v string) Option
- func WithAppVersion(v string) Option
- func WithCaller(v bool) Option
- func WithConfig(v Config) Option
- func WithConsoleColored(v bool) Option
- func WithLogFormat(v LogFormat) Option
- func WithLogLevel(v LogLevel) Option
- func WithStackTrace(v bool) Option
- func WithTimeKey(v string) Option
- func WithZapOption(v zap.Option) Option
- type Sink
- type WriteSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Format LogFormat `yaml:"format" env:"FORMAT" default:"json" usage:"allows to set custom formatting" example:"json"` Level LogLevel `yaml:"level" env:"LEVEL" default:"info" usage:"allows to set custom logger level" example:"info"` ConsoleColored bool `yaml:"console_colored" env:"CONSOLE_COLORED" default:"false" usage:"allows to set colored console output" example:"false"` Trace LogLevel `yaml:"trace" env:"TRACE" default:"fatal" usage:"allows to set custom trace level" example:"fatal"` WithCaller bool `yaml:"with_caller" env:"WITH_CALLER" default:"false" usage:"allows to show caller" example:"false"` WithStackTrace bool `yaml:"with_stack_trace" env:"WITH_STACK_TRACE" default:"false" usage:"allows to show stack trace" example:"false"` }
type ExtendedLogger ¶
func DefaultExtended ¶ added in v0.1.0
func DefaultExtended() ExtendedLogger
Default returns default extended logger instance
func NewExtended ¶
func NewExtended(opts ...Option) ExtendedLogger
NewExtended - init new extended logger with options
func WithExtended ¶ added in v0.2.6
func WithExtended(l ExtendedLogger, args ...any) ExtendedLogger
WithExtended allows to provide zap.SugaredLogger as common interface.
type Logger ¶
type Logger interface { Debug(...any) Debugln(...any) Debugf(template string, args ...any) Debugw(msg string, keysAndValues ...any) Info(...any) Infoln(...any) Infof(template string, args ...any) Infow(msg string, keysAndValues ...any) Warn(...any) Warnln(...any) Warnf(template string, args ...any) Warnw(msg string, keysAndValues ...any) Error(...any) Errorln(...any) Errorf(template string, args ...any) Errorw(msg string, keysAndValues ...any) Fatal(...any) Fatalln(...any) Fatalf(template string, args ...any) Fatalw(msg string, keysAndValues ...any) Panic(...any) Panicln(...any) Panicf(template string, args ...any) Panicw(msg string, keysAndValues ...any) }
Logger common interface
type Option ¶
type Option func(*logger)
func WithAppName ¶
WithAppName allows to set application name to logger fields.
func WithAppVersion ¶
WithAppVersion allows to set application version to logger fields.
func WithCaller ¶
func WithConfig ¶
func WithConsoleColored ¶
WithConsoleColored allows to set colored console output.
func WithLogFormat ¶
func WithLogLevel ¶
func WithStackTrace ¶
func WithTimeKey ¶
func WithZapOption ¶
WithZapOption allows to set zap.Option.
type WriteSyncer ¶
type WriteSyncer = zapcore.WriteSyncer
WriteSyncer is an io.Writer that can also flush any buffered data. Note that *os.File (and thus, os.Stderr and os.Stdout) implement WriteSyncer. Type alias.
Click to show internal directories.
Click to hide internal directories.