Macro config

Source
config!() { /* proc-macro */ }
Expand description

Log a CONFIG message.

CONFIG is a message level for static configuration messages.

CONFIG messages are intended to provide a variety of static configuration information, to assist in debugging problems that may be associated with particular configurations.

For example, a CONFIG message might include the CPU type, the graphics depth, the GUI look-and-feel, etc.

If the logger is currently enabled for the CONFIG message level then the given message is forwarded to all the registered output Handler objects.

§Parameters

§Examples

use flogging::*;
use chrono::Local;

const_logger!({
    Logger::console_logger(module_path!())
});

#[logger]
pub fn my_func(data: &str) {
    config!("Some text to store.");

    let time = Local::now();

    config!(time);
    config!(time, data);
    config!("The configuration as at: {}", time);
    config!("The configuration as at: {time}: {}", data);
    config!("The configuration as at: {time:?}: {data}");
}

fn main(){
    let data = "Some data";
    my_func(data);
}

Output:

|flogging->my_func| [CONFIG ] Some text to store.
|flogging->my_func| [CONFIG ] 2025-07-18 19:52:06.927418853 +08:00
|flogging->my_func| [CONFIG ] 2025-07-18 19:52:06.927418853 +08:00, Some data
|flogging->my_func| [CONFIG ] The configuration as at: 2025-07-18 19:52:06.927418853 +08:00
|flogging->my_func| [CONFIG ] The configuration as at: 2025-07-18 19:52:06.927418853 +08:00: Some data
|flogging->my_func| [CONFIG ] The configuration as at: 2025-07-18T19:52:06.927418853+08:00: Some data