Currently, it is necessary to figure out how each log method will be called in order to specify a count of stack frames to Caller.
|
// Caller returns a Valuer that returns a file and line from a specified depth |
|
// in the callstack. Users will probably want to use DefaultCaller. |
|
func Caller(depth int) Valuer { |
This makes functions that wrap or forward to go-kit/log hard to use.
Suggestion: have a Helper method like in testing, which tells Caller to skip that function from the count.
This would be relatively expensive – a stack walk, lock and map lookup each time the helper is entered, and more map lookups when actually logging – but much more pleasant to use.
Currently, it is necessary to figure out how each log method will be called in order to specify a count of stack frames to
Caller.log/value.go
Lines 82 to 84 in 5739c26
This makes functions that wrap or forward to
go-kit/loghard to use.Suggestion: have a Helper method like in
testing, which tellsCallerto skip that function from the count.This would be relatively expensive – a stack walk, lock and map lookup each time the helper is entered, and more map lookups when actually logging – but much more pleasant to use.