Documentation ¶
Index ¶
- Constants
- func NewZapLogger(level zapcore.Level, logFormat string) (*zap.Logger, error)
- type Logger
- func (l *Logger) ClearFields(reqID string)
- func (l *Logger) Debug(msg string, fields ...zap.Field)
- func (l *Logger) DebugWithID(reqID string, msg string, fields ...zap.Field)
- func (l *Logger) Error(msg string, fields ...zap.Field)
- func (l *Logger) ErrorWithID(reqID string, msg string, fields ...zap.Field)
- func (l *Logger) Fatal(msg string, fields ...zap.Field)
- func (l *Logger) FatalWithID(reqID string, msg string, fields ...zap.Field)
- func (l *Logger) Info(msg string, fields ...zap.Field)
- func (l *Logger) InfoWithID(reqID string, msg string, fields ...zap.Field)
- func (l *Logger) Warn(msg string, fields ...zap.Field)
- func (l *Logger) WarnWithID(reqID string, msg string, fields ...zap.Field)
- func (l *Logger) WithFields(fields ...zap.Field) *Logger
- func (l *Logger) WriteFields(reqID string, fields ...zap.Field)
Constants ¶
View Source
const RequestIDFieldName = "requestID"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
func NewLogger ¶
NewLogger returns the logging wrapper for a given *zap.logger. Noop logger bypasses the setting of fields, improving performance. If *zap.Logger is nil a noop logger is set and the reqIDLogging argument is overwritten to false
func (*Logger) ClearFields ¶
ClearFields clears all stored fields for a given requestID, important for maintaining performance
func (*Logger) DebugWithID ¶
func (*Logger) ErrorWithID ¶
func (*Logger) FatalWithID ¶
func (*Logger) InfoWithID ¶
func (*Logger) WarnWithID ¶
func (*Logger) WithFields ¶
WithFields creates a new logging wrapper with a predefined base set of fields. These fields will be added to each request, but the logger will still read/write from the highest level logging wrappers field pool
Click to show internal directories.
Click to hide internal directories.