Open J0eJ0h opened 4 years ago
Hmm if you have an error the trace should be using the error
severity: https://github.com/apex/log/blob/master/entry.go#L156, but yeah as you mentioned there's no way to tweak the initial Trace event, I'm not sure what would be best there.
I always enable INFO level in production personally, it's better to have more info than not enough, which is partly why I started https://apex.sh/logs/ :D, it's cost-effective enough to hold onto all those INFOs. I'm not against adding something like TraceAt()
but wouldn't the Stop(err)
be enough in the case you're mentioning?
This would be a very desired feature; There are a lot of times when we want to use a Trace
with DebugLevel
. Current best option is to manually implement that.
If I make a PR, would there be interest in merging it?
It should be possible to explicitly set the level on Trace. (Imagine Info is turned off and a failure mode where you really want to know the time it took to recover).
I initially thought I could do it with the Level field in Entry, but it's never honored.
The reason this is an issue, not a PR, is that this is a great library and I defer to the core team on how to handle this.
That said, for this issue I'd just add a new TraceAt that took the level in, and modify the base Trace and Stop to use the Level field in Entry.