diff --git a/src-tauri/src/config/verge.rs b/src-tauri/src/config/verge.rs index 1440aa8..edd6616 100644 --- a/src-tauri/src/config/verge.rs +++ b/src-tauri/src/config/verge.rs @@ -10,7 +10,7 @@ pub struct IVerge { pub app_singleton_port: Option, /// app log level - /// `trace` `debug` `info` `warn` `error` + /// silent | error | warn | info | debug | trace pub app_log_level: Option, // i18n @@ -193,11 +193,12 @@ impl IVerge { pub fn get_log_level(&self) -> LevelFilter { if let Some(level) = self.app_log_level.as_ref() { match level.to_lowercase().as_str() { - "trace" => LevelFilter::Trace, - "debug" => LevelFilter::Debug, - "info" => LevelFilter::Info, - "warn" => LevelFilter::Warn, + "silent" => LevelFilter::Off, "error" => LevelFilter::Error, + "warn" => LevelFilter::Warn, + "info" => LevelFilter::Info, + "debug" => LevelFilter::Debug, + "trace" => LevelFilter::Trace, _ => LevelFilter::Info, } } else { diff --git a/src-tauri/src/utils/init.rs b/src-tauri/src/utils/init.rs index 4135441..2fae79d 100644 --- a/src-tauri/src/utils/init.rs +++ b/src-tauri/src/utils/init.rs @@ -18,6 +18,9 @@ fn init_log() -> Result<()> { } let log_level = Config::verge().data().get_log_level(); + if log_level == LevelFilter::Off { + return Ok(()); + } let local_time = Local::now().format("%Y-%m-%d-%H%M").to_string(); let log_file = format!("{}.log", local_time); diff --git a/src/components/setting/mods/misc-viewer.tsx b/src/components/setting/mods/misc-viewer.tsx index 2bd884c..009d898 100644 --- a/src/components/setting/mods/misc-viewer.tsx +++ b/src/components/setting/mods/misc-viewer.tsx @@ -83,9 +83,9 @@ export const MiscViewer = forwardRef((props, ref) => { })); }} > - {["trace", "debug", "info", "warn", "error"].map((i) => ( + {["trace", "debug", "info", "warn", "error", "silent"].map((i) => ( - {i} + {i[0].toUpperCase() + i.slice(1).toLowerCase()} ))}