Speed up timestamp generation when logging (#9933)

* Speed up timestamp generation when logging

* Align to review comments.

* Correct a typo
This commit is contained in:
Koute
2021-10-05 21:15:18 +09:00
committed by GitHub
parent d45aada6a7
commit 400f3e6579
7 changed files with 230 additions and 21 deletions
@@ -17,8 +17,7 @@
use once_cell::sync::OnceCell;
use parking_lot::Mutex;
use tracing_subscriber::{
filter::Directive, fmt as tracing_fmt, fmt::time::ChronoLocal, layer, reload::Handle,
EnvFilter, Registry,
filter::Directive, fmt as tracing_fmt, layer, reload::Handle, EnvFilter, Registry,
};
// Handle to reload the tracing log filter
@@ -109,6 +108,6 @@ pub(crate) fn set_reload_handle(handle: Handle<EnvFilter, SCSubscriber>) {
// Used in the reload `Handle`.
type SCSubscriber<
N = tracing_fmt::format::DefaultFields,
E = crate::logging::EventFormat<ChronoLocal>,
E = crate::logging::EventFormat,
W = fn() -> std::io::Stderr,
> = layer::Layered<tracing_fmt::Layer<Registry, N, E, W>, Registry>;