You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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?
sjbarag
added a commit
to sjbarag/log
that referenced
this issue
Apr 16, 2022
The Trace() and Stop() methods for an Entry default to Info-level
logging, and previously didn't offer a way to log non-errors at any
other level. Add a WithTraceAt() method to allow that level to be
configured.
fixesapex#93
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.
The text was updated successfully, but these errors were encountered: