rlg

Macro macro_log_with_metadata

Source
macro_rules! macro_log_with_metadata {
    ($session_id:expr, $time:expr, $level:expr, $component:expr, $description:expr, $format:expr) => { ... };
}
Expand description

This macro logs with metadata. It replaces specific keys in the log message with consistent ones.

§Parameters

  • session_id: A unique identifier for the log session.
  • time: The timestamp of the log entry.
  • level: The severity level of the log.
  • component: The system component that generated the log.
  • description: A textual description of the log event.
  • format: The format in which the log will be recorded.

§Example

use rlg::{macro_log_with_metadata, log_level::LogLevel, log_format::LogFormat};
let log = macro_log_with_metadata!("id", "2022-01-01", &LogLevel::INFO, "app", "message", &LogFormat::JSON);
println!("{log} | Metadata: <metadata>");

Usage: let log = macro_log_with_metadata!(session_id, time, level, component, description, format); Macro for logging with metadata