From 5f13148aad6a0752dc41f3b7ab75e8ba888c38a2 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 17 Jan 2023 18:30:06 -0300 Subject: [PATCH] simplify default formatter for mobile --- plugins/log/src/lib.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 62194d57..ae170080 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -155,13 +155,18 @@ impl Default for Builder { time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") .unwrap(); let dispatch = fern::Dispatch::new().format(move |out, message, record| { - out.finish(format_args!( - "{}[{}][{}] {}", - time::OffsetDateTime::now_utc().format(&format).unwrap(), - record.target(), - record.level(), - message - )) + out.finish( + #[cfg(mobile)] + format_args!("[{}] {}", record.target(), message), + #[cfg(desktop)] + format_args!( + "{}[{}][{}] {}", + time::OffsetDateTime::now_utc().format(&format).unwrap(), + record.target(), + record.level(), + message + ), + ) }); Self { dispatch,