diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-03-24 17:52:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-24 17:52:42 +0800 |
commit | 37e252587a3429ab71cbb3ace7dca09733fa6c7c (patch) | |
tree | b73049695e8064ae54b048358f949966e0e5361f /log | |
parent | bb7dca275c44fe9d176e629b3440adf92d26a150 (diff) | |
parent | 69ac6cc70e4f2e712be91be2795ef79bce3f0e89 (diff) | |
download | dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar.gz dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar.bz2 dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar.lz dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar.xz dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.tar.zst dexon-37e252587a3429ab71cbb3ace7dca09733fa6c7c.zip |
Merge pull request #3813 from fjl/build-fixes-2
build: unify vendor skipping, always run go vet
Diffstat (limited to 'log')
-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. |