Documentation ¶
Index ¶
- Constants
- type Level
- type Logger
- func (l *Logger) Debug(msg string, fields ...zap.Field)
- func (l *Logger) Error(msg string, fields ...zap.Field)
- func (l *Logger) Info(msg string, fields ...zap.Field)
- func (l *Logger) Warn(msg string, fields ...zap.Field)
- func (l *Logger) WithField(field zap.Field) *Logger
- func (l *Logger) WithFields(fields ...zap.Field) *Logger
- type OptionFunc
Constants ¶
View Source
const ( TimeKey = "timestamp" LevelKey = "level" NameKey = "logger" CallerKey = "caller" MessageKey = "msg" StackTraceKey = "stacktrace" CorrelationIDKey = "correlation-id" SpanIDKey = "span-id" TraceIDKey = "trace-id" HostnameKey = "hostname" ServiceNameKey = "service-name" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger uses the uber zap logger package at its core logger
func New ¶
func New(service string, options ...OptionFunc) *Logger
New creates a new logger with the given service name
setting log level and custom output are done by WithLevel() and WithOutput() funcs of this pkg these funcs are completely optional upon calling New()
type OptionFunc ¶
type OptionFunc func(*Logger)
func WithLevel ¶
func WithLevel(level string) OptionFunc
WithLevel allows setting a custom level to the logger
func WithOutput ¶
func WithOutput(output zapcore.WriteSyncer) OptionFunc
WithOutput allows setting a custom output to the logger
Click to show internal directories.
Click to hide internal directories.