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, or Trace. See crate::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, where key is an identifier and value an expression that implements the Display trait.
  • key = ?value, where key is an identifier and value an expression that implements the Debug trait.
  • key, which is syntax sugar for key = key.
  • ?key, which is syntax sugar for key = ?key.