diff options
Diffstat (limited to 'log/handler.go')
-rw-r--r-- | log/handler.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/log/handler.go b/log/handler.go index abb17b4c4..d5594b853 100644 --- a/log/handler.go +++ b/log/handler.go @@ -106,11 +106,16 @@ func CallerFileHandler(h Handler) Handler { // the context with key "fn". func CallerFuncHandler(h Handler) Handler { return FuncHandler(func(r *Record) error { - r.Ctx = append(r.Ctx, "fn", fmt.Sprintf("%+n", r.Call)) + r.Ctx = append(r.Ctx, "fn", formatCall("%+n", r.Call)) return h.Log(r) }) } +// This function is here to please go vet on Go < 1.8. +func formatCall(format string, c stack.Call) string { + return fmt.Sprintf(format, c) +} + // CallerStackHandler returns a Handler that adds a stack trace to the context // with key "stack". The stack trace is formated as a space separated list of // call sites inside matching []'s. The most recent call site is listed first. |