rlg

Macro macro_log

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

This macro simplifies the creation of log entries with specific parameters. It returns a new Log instance based on the provided session ID, time, level, component, description, and format.

§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, log_level::LogLevel, log_format::LogFormat};
let log = macro_log!("id", "2022-01-01", &LogLevel::INFO, "app", "message", &LogFormat::JSON);

Usage: let log = macro_log!(session_id, time, level, component, description, format); Macro to create a new log easily