Refactor logging to use a centralized logging utility across the application (#5277)

- Replaced direct log calls with a new logging macro that includes a logging type for better categorization.
- Updated logging in various modules including `merge.rs`, `mod.rs`, `tun.rs`, `clash.rs`, `profile.rs`, `proxy.rs`, `window.rs`, `lightweight.rs`, `guard.rs`, `autostart.rs`, `dirs.rs`, `dns.rs`, `scheme.rs`, `server.rs`, and `window_manager.rs`.
- Introduced logging types such as `Core`, `Network`, `ProxyMode`, `Window`, `Lightweight`, `Service`, and `File` to enhance log clarity and filtering.
This commit is contained in:
Tunglies
2025-11-01 20:47:01 +08:00
committed by GitHub
Unverified
parent 50567d9b97
commit fb260fb33d
28 changed files with 473 additions and 210 deletions

View File

@@ -51,7 +51,11 @@ pub async fn check_singleton() -> Result<()> {
.send()
.await?;
}
log::error!("failed to setup singleton listen server");
logging!(
error,
Type::Window,
"failed to setup singleton listen server"
);
bail!("app exists");
}
Ok(())
@@ -129,7 +133,7 @@ pub fn embed_server() {
}
pub fn shutdown_embedded_server() {
log::info!("shutting down embedded server");
logging!(info, Type::Window, "shutting down embedded server");
if let Some(sender) = SHUTDOWN_SENDER.get()
&& let Some(sender) = sender.lock().take()
{