rlg

Macro macro_log_if

Source
macro_rules! macro_log_if {
    ($predicate:expr, $log:expr) => { ... };
}
Expand description

This macro conditionally logs a message based on a predicate.

§Parameters

  • predicate: A boolean expression that determines whether to log.
  • log: The log entry to be conditionally logged.

§Example

use rlg::{macro_log_if, macro_print_log};
use rlg::macro_info_log;
let log = macro_info_log!("2022-01-01", "app", "message");
macro_log_if!(true, log);

Usage: macro_log_if!(predicate, log); Conditional logging based on a predicate