I am building a Rust app and I am using Simple Logger to log the init of my app. My main.rs looks like this:
use log::info;
use simple_logger::SimpleLogger;
fn main() {
SimpleLogger::new().init().unwrap();
let (event_loop, mut interface) = create_interface();
info!("Game interface created");
the above code is erroring with:
thread 'main' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', /home/athul/.cargo/registry/src/github.com-1ecc6299db9ec823/simple_logger-1.16.0/src/lib.rs:409:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I've tried:
try_current_local_offset with the time cratebut the error still persists. It's likely that I do not have my time properly initialized for my app. What is the best (and easiest) way to do it?
the comment suggestion from Benjamin Brootz worked. So here's the solution:
SimpleLogger::new().with_utc_timestamps().init().unwrap();
this creates a logger instance with a UTC time stamp. All credits to the said user :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With