macro_rules! r_log {
($level:expr, $($arg:tt)*) => { ... };
}Expand description
Dispatches a formatted log message to the global logger.
This macro is the primary interface for logging throughout the application. It behaves
exactly like standard Rust formatting macros (e.g., println! or format!), allowing
you to easily interpolate variables into your log messages. Messages sent via r_log!
are always processed and distributed to all registered sinks (like terminal and files),
regardless of whether the application is compiled in debug or release mode.
§Arguments
$level- The severity of the log, provided as aLogLevelvariant (e.g.,LogLevel::Info,LogLevel::Warning).$arg- A format string and an arbitrary number of formatting arguments, following standardstd::fmtsyntax.
§Examples
// Basic usage with a simple string
r_log!(LogLevel::Info, "System initialized successfully");
// Formatting with variables
let port = 8080;
r_log!(LogLevel::SuccessEvent, "Server listening on port {}", port);
// Logging complex errors
r_log!(LogLevel::Error, "Failed to load configuration file at {}: {}", path, err);