For a command line app I use env_logger
. At the end of the program I want to know
if there did an error!()
happen so that I can exit with an error code <>l to 0.
I tried to use a global variable for this like follows:
In main.rs
I defined
static ERROR_OCCURED: AtomicBool = AtomicBool::new(false);
In logger.rs
where I format the output message I want to use ERROR_OCCURED
so that in case the error level is log::Level::Error
I can do ERROR_OCCURRED.store(true, Ordering::Relaxed);
.
But I have no idea how I can declare ERROR_OCCURED
in logger.rs
so that I can use it there.