Macro log
macro_rules! log {
(logger: $logger:expr, target: $target:expr, $lvl:expr, $($arg:tt)+) => { ... };
(logger: $logger:expr, $lvl:expr, $($arg:tt)+) => { ... };
(target: $target:expr, $lvl:expr, $($arg:tt)+) => { ... };
($lvl:expr, $($arg:tt)+) => { ... };
}
The standard logging macro.
This macro will generically log with the specified Level and format!
based argument list.
use ;
let data = ;
let private_data = "private";
log!;
Optionally, you can specify a target argument to attach a specific target
to the log record. By default, the target is the module path of the caller.
use ;
let data = ;
let private_data = "private";
log!;
And optionally, you can specify a logger argument to use a specific logger
instead of the default global logger.
#
#
use ;
let data = ;
let private_data = "private";
let my_logger = MyLogger ;
log!;
The logger argument accepts a value that implements the Log trait. The value
will be borrowed within the macro.
Note that the global level set via Cargo features, or through set_max_level will
still apply, even when a custom logger is supplied with the logger argument.