fix: do not parse log except the clash core

This commit is contained in:
GyDi 2023-03-16 10:34:28 +08:00
parent ab429dfeb6
commit e25a455698
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -136,6 +136,7 @@ impl CoreManager {
let clash_core = { Config::verge().latest().clash_core.clone() }; let clash_core = { Config::verge().latest().clash_core.clone() };
let clash_core = clash_core.unwrap_or("clash".into()); let clash_core = clash_core.unwrap_or("clash".into());
let is_clash = clash_core == "clash";
let config_path = dirs::path_to_str(&config_path)?; let config_path = dirs::path_to_str(&config_path)?;
@ -167,8 +168,12 @@ impl CoreManager {
while let Some(event) = rx.recv().await { while let Some(event) = rx.recv().await {
match event { match event {
CommandEvent::Stdout(line) => { CommandEvent::Stdout(line) => {
if is_clash {
let stdout = clash_api::parse_log(line.clone()); let stdout = clash_api::parse_log(line.clone());
log::info!(target: "app", "[clash]: {stdout}"); log::info!(target: "app", "[clash]: {stdout}");
} else {
log::info!(target: "app", "[clash]: {line}");
};
Logger::global().set_log(line); Logger::global().set_log(line);
} }
CommandEvent::Stderr(err) => { CommandEvent::Stderr(err) => {