macro_rules! log { ($level:expr, $obj:expr, $fmt:literal $($args:tt)*) => { ... }; ($level:expr, $fmt:literal $($args:tt)*) => { ... }; }
Expand description
Log a message via the SIMICS logging API.
If an object is provided, the message will be logged through that object. If not,
the message will be logged through the base sim
object. trace
, debug
,
info
, warn
, and error
messages use this macro internally. This macro
takes the log level as its first parameter.
§Examples
ⓘ
use simics::log;
let module_instance = get_object("object_name")?;
let parameter = 0;
log!(LogLevel::Debug, module_instance, "Debug message with parameter {}", parameter);
log!(LogLevel::Debug, "Debug message without object with parameter {}", parameter);
§Panics
This macro will panic of there is an error in the logging call. This is unlikely if the
object is valid, but if your use case requires handling errors or is dynamically generating
objects without static lifetimes, you should use the internal [log_info
] API instead.