borntyping / rust-simple_logger

A rust logger that prints all messages with a readable output format.
https://crates.io/crates/simple_logger
MIT License
221 stars 48 forks source link

Feature request: Allow specifying a custom UTC offset for timestamps #50

Closed msrd0 closed 2 years ago

msrd0 commented 2 years ago

This makes it possible to use the logger with local timestamps in multi-threadded applications that only run for a short duration, so switching between timezones (e.g. due to daylight saving stuff) wouldn't be an issue.

borntyping commented 2 years ago

I think this should be reasonably easy to add? I'll take a look when I have some time.

borntyping commented 2 years ago

An option to use a static UTC offset has been included in simple_logger 2.0.0.

msrd0 commented 2 years ago

Thank you for implementing this feature.

Is it possible to have a constant width timestamp with version 2.0.0? With version 1.16.0 all messages were perfectly aligned, as there were always 3 decimal places of the second printed, but now I see varying length of decimal places which makes the rest of the log become unaligned.

borntyping commented 2 years ago

Oh, that's really annoying. I'll take a look tommorow.

I've seen similar issues in other languages before where values like .100 get shortened to .1.