Function ocli::init

source ·
pub fn init(level: Level) -> Result<(), SetLoggerError>
Expand description

Initializes the logger.

This also consumes the logger. It cannot be further modified after initialization.

§Example

#[macro_use] extern crate log;
extern crate ocli;

fn main() {
    ocli::init(log::Level::Info).unwrap();

    error!("This is printed to stderr, with the 'error: ' prefix");
    warn!("This is printed to stderr, with the 'warn: ' prefix"");
    info!("This is printed to stderr, without prefix");
    debug!("This is not printed");
    trace!("This is not printed");
}