Documentation ¶
Overview ¶
Package zap_logger provides an implementation of the Yall logger interface
Index ¶
- func NewLogger(name string, opts ...LoggerOpt) (yall.Logger, error)
- type Logger
- func (l *Logger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Debugnc(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Errornc(msg string, keysAndValues ...interface{})
- func (l *Logger) ExecutionIDFrom(ctx context.Context) string
- func (l *Logger) Fatal(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Fatalnc(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Infonc(msg string, keysAndValues ...interface{})
- func (l *Logger) Panic(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Panicnc(msg string, keysAndValues ...interface{})
- func (l *Logger) Warn(ctx context.Context, msg string, keysAndValues ...interface{})
- func (l *Logger) Warnnc(msg string, keysAndValues ...interface{})
- func (l *Logger) With(args ...interface{}) yall.Logger
- type LoggerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is just a thin wrapper around a sugared zap logger with some opinionated defaults.
func (*Logger) ExecutionIDFrom ¶
ExecutionIDFrom retrieves the execution id from the given context, if present.
type LoggerOpt ¶
type LoggerOpt func(opts *loggerConf) *loggerConf
func Production ¶
func Production() LoggerOpt
Production uses a zap production config, with ISO 8601 timestamps.
func WithExecutionIDContextKey ¶
func WithExecutionIDContextKey(requestIDContextKey interface{}) LoggerOpt
WithExecutionIDContextKey configures the key to use to extract execution id from context.
func WithExecutionIDKey ¶
WithExecutionIDKey sets the key to use to log the execution id.
func WithNameKey ¶
WithNameKey configures the key to use for the logger's name.
func WithOmitExecutionIDWhenMissing ¶
func WithOmitExecutionIDWhenMissing() LoggerOpt
Click to show internal directories.
Click to hide internal directories.