Documentation ¶
Index ¶
- Variables
- func Alert(args ...interface{})
- func Alertf(format string, args ...interface{})
- func Alertln(args ...interface{})
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func Log(ctx context.Context) logrus.FieldLogger
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func PrintPanics(next http.Handler) http.Handler
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func RedirectStdlogOutput(logger *logrus.Logger)
- func RequestLog(r *http.Request) logrus.FieldLogger
- func RequestLogger(logger *logrus.Logger) func(next http.Handler) http.Handler
- func SanitizingRequestLogger(logger *logrus.Logger, rules map[string]string) func(next http.Handler) http.Handler
- func SetEntryField(ctx context.Context, key string, value interface{})
- func SetEntryFields(ctx context.Context, fields map[string]interface{})
- func SetRequestEntryField(r *http.Request, key string, value interface{})
- func SetRequestEntryFields(r *http.Request, fields map[string]interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- func WithError(err error) *logrus.Entry
- func WithField(key string, value interface{}) *logrus.Entry
- func WithFields(fields logrus.Fields) *logrus.Entry
- func WithLogEntry(parent context.Context, logEntry *HTTPLoggerEntry) context.Context
- func WithLoggerContext(parent context.Context, logger *logrus.Logger) context.Context
- type HTTPLogger
- type HTTPLoggerEntry
- type SanitizingHTTPLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoggerCtxKey = &contextKey{"Logger"} LogEntryCtxKey = &contextKey{"LogEntry"} )
Functions ¶
func PrintPanics ¶
PrintPanics is a development middleware that preempts the request logger and prints a panic message and stack trace to stdout.
func RedirectStdlogOutput ¶
func RequestLog ¶
func RequestLog(r *http.Request) logrus.FieldLogger
func RequestLogger ¶
RequestLogger is a middleware for the github.com/sirupsen/logrus to log requests. It is equipt to handle recovery in case of panics and record the stack trace with a panic log-level.
func SanitizingRequestLogger ¶ added in v1.0.1
func SanitizingRequestLogger(logger *logrus.Logger, rules map[string]string) func(next http.Handler) http.Handler
SanitizingRequestLogger is a middleware for the github.com/sirupsen/logrus to log requests. It is equipt to handle recovery in case of panics and record the stack trace with a panic log-level. It's second parameter is a map[string]string of replacements for parameters to be sanitized before logging Example:
map[string]string{ "token": "[redacted]", "session": "removed-sesion-id", }
func SetEntryField ¶
func SetEntryFields ¶
func SetRequestEntryField ¶
func SetRequestEntryFields ¶
func WithLogEntry ¶
func WithLogEntry(parent context.Context, logEntry *HTTPLoggerEntry) context.Context
Types ¶
type HTTPLogger ¶
func (*HTTPLogger) NewLogEntry ¶
func (l *HTTPLogger) NewLogEntry(r *http.Request) *HTTPLoggerEntry
type HTTPLoggerEntry ¶
type HTTPLoggerEntry struct { Logger logrus.FieldLogger // field logger interface, created by RequestLogger Level *logrus.Level // intended log level to write when request finishes }
func (*HTTPLoggerEntry) Panic ¶
func (l *HTTPLoggerEntry) Panic(rec interface{}, stack []byte)
type SanitizingHTTPLogger ¶ added in v1.0.1
func (*SanitizingHTTPLogger) NewLogEntry ¶ added in v1.0.1
func (l *SanitizingHTTPLogger) NewLogEntry(r *http.Request) *HTTPLoggerEntry
Source Files ¶
Click to show internal directories.
Click to hide internal directories.