From 6b4c3917389f4bc489d03b48a837557ac0584175 Mon Sep 17 00:00:00 2001 From: Seishiin <26900347+Seishiin@users.noreply.github.com> Date: Sat, 8 Feb 2025 02:41:34 +0100 Subject: [PATCH] fix(log): timezone_strategy overwriting LogLevels (#2401) --- .changes/log-timezone_strategy-loglevel-fix.md | 6 ++++++ plugins/log/src/lib.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/log-timezone_strategy-loglevel-fix.md diff --git a/.changes/log-timezone_strategy-loglevel-fix.md b/.changes/log-timezone_strategy-loglevel-fix.md new file mode 100644 index 00000000..b3787e0d --- /dev/null +++ b/.changes/log-timezone_strategy-loglevel-fix.md @@ -0,0 +1,6 @@ +--- +"log": patch +"log-js": patch +--- + +Fix timezone_strategy overwriting previously set LogLevels. diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index e7848ff4..9f9a4adf 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -278,7 +278,7 @@ impl Builder { let format = time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") .unwrap(); - self.dispatch = fern::Dispatch::new().format(move |out, message, record| { + self.dispatch = self.dispatch.format(move |out, message, record| { out.finish(format_args!( "{}[{}][{}] {}", timezone_strategy.get_now().format(&format).unwrap(),