macro_rules! event_report {
($level:expr, $err:expr, $fmt:literal, $($arg:expr),* $(,)?) => { ... };
($level:expr, $err:expr, $fmt:literal) => { ... };
(@raw $level:expr, $err:expr, $fmt:literal $(, $arg:expr)* $(,)?) => { ... };
}
Available on crate feature
tracing
only.Expand description
Log a Report
of a provided error at a given level, or a
higher level if appropriate.
(If ErrorKind::is_always_a_warning
returns true for the error’s kind, we
log it at WARN, unless this event is already at level WARN or ERROR.)
We require that the format string not end with ’ ’, ‘,’ or ‘:’; if it doesn’t, we produce a compile-time error.
§Examples
use tor_error::event_report;
use tracing::Level;
event_report!(Level::DEBUG, err, "Couldn't chew gum while walking");
event_report!(Level::TRACE, err, "Ephemeral error on attempt #{}", num);
§Limitations
This macro does not support the full range of syntaxes supported by
[tracing::event!
].
The compile-time error produced when the format string has a bad ending is
kind of confusing. This is a limitation of the static_assertions
crate.