Macro init_cli_log

Source
macro_rules! init_cli_log {
    () => { ... };
    ($app_name: expr) => { ... };
}
Expand description

Configure the application log according to env variable, without failing in case of io error.

If the log file cannot be created, the error is printed to stderr, then the application proceeds without logging.

Example:

cli_log::init_cli_log!();

You may specify an altername application name instead of your crate name:

cli_log::init_cli_log!("my-app");

The application name will also be used to derive the env variable name giving the log level, for example MY_APP_LOG=info for an application named my-app.

The point of using this macro instead of the init function is to ensure env!(CARGO_PKG_NAME) and env!(CARGO_PKG_VERSION) are expanded for the outer package, not for cli-log