Macro smoldot_light::log
source ยท macro_rules! log { ($plat:expr, $level:ident, $target:expr, $message:expr) => { ... }; ($plat:expr, $level:ident, $target:expr, $message:expr, $($params:tt)*) => { ... }; }
Expand description
Helper macro for using the crate::platform::PlatformRef::log
function.
This macro takes at least 4 parameters:
- A reference to an implementation of the
crate::platform::PlatformRef
trait. - A log level:
Error
,Warn
,Info
,Debug
, orTrace
. Seecrate::platform::LogLevel
. - A
&str
representing the target of the logging. This can be used in order to filter log entries belonging to a specific target. - An object that implements of
AsRef<str>
and that contains the log message itself.
In addition to these parameters, the macro accepts an unlimited number of extra (comma-separated) parameters.
Each parameter has one of these four syntaxes:
key = value
, wherekey
is an identifier andvalue
an expression that implements theDisplay
trait.key = ?value
, wherekey
is an identifier andvalue
an expression that implements theDebug
trait.key
, which is syntax sugar forkey = key
.?key
, which is syntax sugar forkey = ?key
.