Macro loggy::is_an_error

source ·
macro_rules! is_an_error {
    ($default:expr) => { ... };
}
Expand description

Provide program-wide control over whether some note(s) are considered to be an error.

This is typically invoked as pub mod some_condition { is_an_error!(true /* or false */); }.

This will define a nested module which exposes the following:

  • pub fn is_an_error() -> bool returns whether the event is considered to be an error. This is initialized to the value passed to the macro.

    This is intended to be used in note!, which will behave as either an error! or a warn! depending on the value.

  • pub fn set_is_an_error(new_value: bool) -> bool sets whether the event is considered to be an error, returning the old value for convenience.

    This allows the program to modify the setting at run-time, for example by parsing the command line arguments. TODO: Provide additional functions to automate this.