/// Set the global logger, enabling the use of `log!()` macros.
/// This can be done at any time, but it can only be done once.
///
/// It returns an object for setting up `GLOBAL_LOGFILE`, leveraging the
/// "unused variable" lint to help remind you to do this once possible.
Set the global logger, enabling the use of `log!()` macros.
This can be done at any time, but it can only be done once.

It returns an object for setting up `GLOBAL_LOGFILE`, leveraging the
"unused variable" lint to help remind you to do this once possible.
Set the global logger enabling the use of ` log! () ` macros . This can be done at any time but it can only be done once . It returns an object for setting up ` GLOBAL_LOGFILE ` leveraging the " unused variable " lint to help remind you to do this once possible .
pub fn init_global_logger() -> FailResult<SetGlobalLogfile>
{
    let log_mod_setting = crate::env::log_mod()?;
    let colors = colors::ColoredLevelConfig {
        error: colors::Color::BrightRed,
        warn:  colors::Color::Yellow, // non-bright yellow is orange in many color schemes
        info:  colors::Color::BrightCyan,
        debug: colors::Color::BrightYellow,
        trace: colors::Color::Cyan,
    };
    // NOTE
    // It might seem silly that we are setting up the initial logging filter by
    // tweaking the env_logger filter rather than calling the `level` and `level_for`
    // methods on fern::Dispatch.  The reason is because fern's filter uses AND logic
    // (a message must successfully pass through ALL filters individually), but I want
    // RUST_LOG to be capable of *increasing* the verbosity.
    //
    // env_logger::filter does not expose a list of targets and level filters, so this
    // is our only option at the moment.
    let env_filter = {
        env_logger::filter::Builder::new()
            .parse("debug")
            .parse("rsp2_tasks=trace")
            .parse("rsp2_tasks::ev_analysis=debug")
            .parse("rsp2_minimize=trace")
            .parse("rsp2_phonopy_io=trace")
            .parse("rsp2_minimize::hager_ls=debug")
            .parse("rsp2_minimize::exact_ls=debug")
            // not an actual module. Some debug output files are generated if you enable `trace` for
            // specific paths under this. (don't set the whole module to `trace`; you will quickly
            // fill your hard drive!)
            .parse("rsp2_tasks::special=info")
            .parse(&crate::env::rust_log()?)
            .build()
    };
    let start = time::Instant::now();
    let fern = fern::Dispatch::new()
        .format(move |out, message, record| {
            let message = fmt_log_message_lines(message, &colors, record, start.elapsed(), log_mod_setting);
            out.finish(format_args!("{}", message))
        })
        .filter(move |metadata| env_filter.enabled(metadata))
        .chain(&*GLOBAL_LOGFILE as &dyn Log)
        .chain(Box::new(CapturableStderr) as Box<dyn Log>)
        ;
    fern.apply()?;
    Ok(SetGlobalLogfile(()))
}
pub fn init_global_logger ( ) -> FailResult < SetGlobalLogfile > { let log_mod_setting = crate :: env :: log_mod ( ) ? ; let colors = colors :: ColoredLevelConfig { error : colors :: Color :: BrightRed , warn : colors :: Color :: Yellow , // non-bright yellow is orange in many color schemes info : colors :: Color :: BrightCyan , debug : colors :: Color :: BrightYellow , trace : colors :: Color :: Cyan , } ; // NOTE // It might seem silly that we are setting up the initial logging filter by // tweaking the env_logger filter rather than calling the `level` and `level_for` // methods on fern::Dispatch.  The reason is because fern's filter uses AND logic // (a message must successfully pass through ALL filters individually), but I want // RUST_LOG to be capable of *increasing* the verbosity. // // env_logger::filter does not expose a list of targets and level filters, so this // is our only option at the moment. let env_filter = { env_logger :: filter :: Builder :: new ( ) . parse ( " " ) . parse ( " " ) . parse ( " " ) . parse ( " " ) . parse ( " " ) . parse ( " " ) . parse ( " " ) // not an actual module. Some debug output files are generated if you enable `trace` for // specific paths under this. (don't set the whole module to `trace`; you will quickly // fill your hard drive!) . parse ( " " ) . parse ( & crate :: env :: rust_log ( ) ? ) . build ( ) } ; let start = time :: Instant :: now ( ) ; let fern = fern :: Dispatch :: new ( ) . format ( move | out , message , record | { let message = fmt_log_message_lines ( message , & colors , record , start . elapsed ( ) , log_mod_setting ) ; out . finish ( format_args ! ( " " message ) ) } ) . filter ( move | metadata | env_filter . enabled ( metadata ) ) . chain ( & * GLOBAL_LOGFILE as & dyn Log ) . chain ( Box :: new ( CapturableStderr ) as Box < dyn Log > ) ; fern . apply ( ) ? ; Ok ( SetGlobalLogfile ( ( ) ) ) }
Set the global logger, enabling the use of `log!
Set the global logger enabling the use of ` log!