feat(logging): introduce clash-verge-logging crate for management (#5486)

* feat(logging): introduce clash-verge-logging crate for management

- Added a new crate `clash-verge-logging` with dependencies on `log`, `tokio`, `compact_str`, and `flexi_logger`.
- Implemented logging types and macros for structured logging across the application.
- Replaced existing logging imports with the new `clash_verge_logging` crate in various modules.
- Updated logging functionality to support different logging types and error handling.
- Refactored code to improve logging consistency and maintainability.

* fix(logging): update import paths for clash_verge_logging in linux.rs and dns.rs

* fix(logging): update import statement for clash_verge_logging in windows.rs
This commit is contained in:
Tunglies
2025-11-17 10:42:57 +08:00
committed by GitHub
parent 635f63e9e5
commit 0866b93175
61 changed files with 145 additions and 169 deletions
+3 -4
View File
@@ -1,8 +1,7 @@
#[cfg(target_os = "macos")]
use crate::{logging, utils::logging::Type};
use clash_verge_logging::{Type, logging};
pub async fn set_public_dns(dns_server: String) {
use crate::utils::logging::Type;
use crate::{core::handle, logging, utils::dirs};
use crate::{core::handle, utils::dirs};
use tauri_plugin_shell::ShellExt as _;
let app_handle = handle::Handle::app_handle();
+2 -2
View File
@@ -9,11 +9,11 @@ use crate::{
sysopt,
tray::Tray,
},
logging, logging_error,
module::{auto_backup::AutoBackupManager, lightweight::auto_lightweight_boot, signal},
process::AsyncHandler,
utils::{init, logging::Type, server, window_manager::WindowManager},
utils::{init, server, window_manager::WindowManager},
};
use clash_verge_logging::{Type, logging, logging_error};
pub mod dns;
pub mod scheme;
+1 -2
View File
@@ -8,9 +8,8 @@ use tauri::Url;
use crate::{
config::{Config, PrfItem, profiles},
core::handle,
logging,
utils::logging::Type,
};
use clash_verge_logging::{Type, logging};
pub(super) async fn resolve_scheme(param: &str) -> Result<()> {
logging!(info, Type::Config, "received deep link: {param}");
+1 -1
View File
@@ -6,7 +6,7 @@ use std::sync::{
};
use tokio::sync::Notify;
use crate::{logging, utils::logging::Type};
use clash_verge_logging::{Type, logging};
// 获取 UI 是否准备就绪的全局状态
static UI_READY: AtomicBool = AtomicBool::new(false);
+2 -5
View File
@@ -3,12 +3,9 @@ use tauri::WebviewWindow;
use crate::{
config::Config,
core::handle,
logging_error,
utils::{
logging::Type,
resolve::window_script::{INITIAL_LOADING_OVERLAY, WINDOW_INITIAL_SCRIPT},
},
utils::resolve::window_script::{INITIAL_LOADING_OVERLAY, WINDOW_INITIAL_SCRIPT},
};
use clash_verge_logging::{Type, logging_error};
// 定义默认窗口尺寸常量
const DEFAULT_WIDTH: f64 = 940.0;