common
common copied to clipboard
Logging: avoid expensive formatting when level is disabled.
This function: https://github.com/weaveworks/common/blob/53b72409d8e7fd53dcac17c6e8d8149bb3c8bc43/logging/gokit.go#L39-L41
will do the printf with all string formatting, memory allocation, etc., regardless of whether debug logging is enabled.
This appears to be the intention of go-kit/log/level; it does not expose any way to ask about levels outside of Log().
We could keep a note of which level is allowed, thus shortcut the Sprintf call above.