Documentation ¶
Overview ¶
Package logger wraps some commonly used functions from zap.Logger and zap.SugaredLogger and maintains a single instance of the logger
Index ¶
- func AddHook(hook func(zapcore.Entry) error)
- func Debug(message string, fields ...zap.Field)
- func Debugf(template string, args ...interface{})
- func Error(message string, fields ...zap.Field)
- func Errorf(template string, args ...interface{})
- func Fatal(message string, fields ...zap.Field)
- func Fatalf(template string, args ...interface{})
- func Info(message string, fields ...zap.Field)
- func Infof(template string, args ...interface{})
- func SugaredWithRequest(r *http.Request) *zap.SugaredLogger
- func Warn(message string, fields ...zap.Field)
- func Warnf(template string, args ...interface{})
- func WithRequest(r *http.Request) *zap.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf allows Sprintf style formatting and logs at debug level
func Error ¶
Error logs the message at error level and prints stacktrace with additional fields, if any
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf allows Sprintf style formatting, logs at error level and prints stacktrace
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf allows Sprintf style formatting, logs at fatal level and exits
func Infof ¶
func Infof(template string, args ...interface{})
Infof allows Sprintf style formatting and logs at info level
func SugaredWithRequest ¶
func SugaredWithRequest(r *http.Request) *zap.SugaredLogger
SugaredWithRequest takes in a http.Request and logs the message with request's Method, Host and Path and returns zap.SugaredLogger to support Sprintf styled logging
Types ¶
This section is empty.