-
Notifications
You must be signed in to change notification settings - Fork 825
Closed
Labels
crate/attributesRelated to the `tracing-attributes` crateRelated to the `tracing-attributes` crategood first issueGood for newcomersGood for newcomerskind/featureNew feature or requestNew feature or request
Description
Feature Request
I'd like to be able to specify the log level that Err
returns are printed at.
Crates
tracing::instrument
Motivation
Currently it's hardcoded as error
, but I have some functions that I'd like to instrument where returning an error is not especially unusual (think of for instance "is the user logged in yet?": any error eventually gets folded into "no, the user is not logged in"). In such cases, I'd like to be able to lower the level to WARN or INFO or even DEBUG.
Proposal
How about an additional attribute err_level
?
#[instrument(level="debug", ret, err, err_level="info")]
fn my_fun() -> Result<int> { Ok(42) }
Alternatives
I could avoid using the instrument macro and annotate every single caller with an event, but that's not really the spirit of the crate :)
Metadata
Metadata
Assignees
Labels
crate/attributesRelated to the `tracing-attributes` crateRelated to the `tracing-attributes` crategood first issueGood for newcomersGood for newcomerskind/featureNew feature or requestNew feature or request