Closed cromulentbanana closed 2 years ago
This is a known issue (https://github.com/borntyping/rust-simple_logger/issues/43, https://github.com/borntyping/rust-simple_logger/issues/44, https://github.com/borntyping/rust-simple_logger/issues/47).
The time
crate's documentation provides more information about this issue: https://time-rs.github.io/internal-api/time/index.html#feature-flags, as does this issue: https://github.com/time-rs/time/issues/293.
There's a list of workarounds for simple_logger
, depending on how you'd prefer to deal with the issue (mostly taken from https://github.com/borntyping/rust-simple_logger/issues/43).
SimpleLogger::new().with_utc_timestamps().init().unwrap();
SimpleLogger::new().without_timestamps().init().unwrap();
time
crate's unsafe features: RUSTFLAGS="--cfg unsound_local_offset"
(docs)Older versions of simple_logger
use a different dependency (chrono
) which is vulnerable to the same problem the time
crate is trying to avoid. The unsound_local_offset
flag from the time
crate makes it work the same way as the chrono
crate. This problem still affects the latest version of the time
crate.
UTC timestamps are now the default in simple_logger 2.0.0.
First, thanks for your contribution to rust logging!
As of version 1.16, I've oserved that simple logger will panic when executed in the tokio async runtime with the following output:
I've provided an example repo that you can clone, in which this bug is triggered:
I realize this panic is probably not due directly to the simple logger codebase itself, but perhaps if the problem indeed lies in
time-rs
, then the dependencytime-rs
can be updated... or something.Currently simple_logger v1.15 is not affected by this problem.
Many thanks in advance!