Improve env_logger output #2629
Closed
winksaville
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @winksaville, thank you for starting this discussion! I personally would think that timestamps are mostly relevant for debugging delays and that in most cases a granularity of seconds would be sufficient. Do you have a specific case in mind where a higher precision is needed? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A simple improvement is to change the timestamp to higher precision, see env_logger search for format_timestamp for more info.
A bigger step is to create a Custom log formatter to provide other desired information. The env_log
format
below has a closure that prints the time, log level, module path, line number and thread_id. You needlog
,env_logger
andhumantime
crates and this code:Because
as_u64()
requires the feature thread_id_value an “unstable” rustc is needed. I usenightly
and buildcargo +nightly build
or add rust-toolchain.toml:Beta Was this translation helpful? Give feedback.
All reactions