go-kit / go-kit/log

Idea: 'Helper' method for Caller

Open
#16 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
193
Forks
20
PR merge metrics
No merged PRs in 30d

Description

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`.
https://github.com/go-kit/log/blob/5739c2646c7293c773ed50d2086e843e3330781c/value.go#L82-L84

This makes functions that wrap or forward to `go-kit/log` hard to use.

Suggestion: have a [Helper](https://pkg.go.dev/testing#T.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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.