mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 03:32:36 +08:00
feat: app log level add silent
This commit is contained in:
parent
aadfaf7150
commit
6b0ca2966e
|
@ -10,7 +10,7 @@ pub struct IVerge {
|
|||
pub app_singleton_port: Option<u16>,
|
||||
|
||||
/// app log level
|
||||
/// `trace` `debug` `info` `warn` `error`
|
||||
/// silent | error | warn | info | debug | trace
|
||||
pub app_log_level: Option<String>,
|
||||
|
||||
// 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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -83,9 +83,9 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
|
|||
}));
|
||||
}}
|
||||
>
|
||||
{["trace", "debug", "info", "warn", "error"].map((i) => (
|
||||
{["trace", "debug", "info", "warn", "error", "silent"].map((i) => (
|
||||
<MenuItem value={i} key={i}>
|
||||
{i}
|
||||
{i[0].toUpperCase() + i.slice(1).toLowerCase()}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
|
|
Loading…
Reference in New Issue
Block a user