emabee / flexi_logger

A flexible logger for rust programs that can write to stderr, stdout, and/or to log files
Apache License 2.0
307 stars 50 forks source link

Option to always use UTC #104

Closed emabee closed 2 years ago

emabee commented 2 years ago

What about introducing an option to always use UTC with no offset?

_Originally posted by @snaar in https://github.com/emabee/flexi_logger/issues/99#issuecomment-981156596_

tdudz commented 2 years ago

yes plz. don't want to deal with time vs. chrono and changing the implementation of my custom format function. also it spits out an error on boot each time that it cant use local on 0.20.1

i know i can now disable error from being printing but i don't want to disable all errors just to hide the ERRCODE:Time

emabee commented 2 years ago

Realized with 0.21.0 (see https://docs.rs/flexi_logger/latest/flexi_logger/struct.Logger.html#method.use_utc)

tdudz commented 2 years ago

hi @emabee thanks for the quick turnaround on this

however, because of the lazy_static, the logger still tries to get the offset once on startup, even if use_utc is set to true. this makes the error message still print out, which is what i would like to avoid. any way you can modify flexi_logger to not evaluate the lazy_static if we're forcing it to use UTC? thanks

emabee commented 2 years ago

That’s ugly, indeed.

emabee commented 2 years ago

Version 0.22 is now out and should fix that!