macro_rules! hclog {
($lvl:path, $key:ident, $($arg:tt)*) => { ... };
}
Expand description
Log a message with severity $lvl
via LogKey
This is this main log macro where all other log macros are based on. It takes a Level
and a LogKey
as well as a format string and arguments to log. Please refer to the
rust documentation for more information
on how to format strings.
Additionally it logs the file, line and function name where the log was called from.
File and line are resolved using the rust compiler built-in macros std::file!()
and
std::line!()
. The function name is resolved via a macro taken from the [crate-stdext
] crate.
It is not intended to call this macro directly because its implementation might change. Use the shortcut macros provided instead:
lEM
, lA
, lC
,
lE
, lW
, lN
,
lI
, lD1
, lD2
,
lD3
, lD4
, lD5
,
lD6
, lD7
, lD8
,
lD9
, lD10
§Example
use hclog::{Level, FacadeVariant, options::Options};
enum HclogKeys { Foo }
use HclogKeys::*;
fn main() {
hclog::hclog!(Level::Info, Foo, "Hello World");
// the lI macro is actually a shortcut for the above line
hclog::lI!(Foo, "Hello World");
}
§Panics
This macro panics if the given $key
is not initialized or $lvl
is not a valid
Level
.
See init_modules
for more information.