mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-13 21:40:33 +08:00
* 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
21 lines
630 B
Rust
21 lines
630 B
Rust
use super::CmdResult;
|
|
use clash_verge_logging::{Type, logging};
|
|
|
|
// TODO: 前端通过 emit 发送更新事件, tray 监听更新事件
|
|
/// 同步托盘和GUI的代理选择状态
|
|
#[tauri::command]
|
|
pub async fn sync_tray_proxy_selection() -> CmdResult<()> {
|
|
use crate::core::tray::Tray;
|
|
|
|
match Tray::global().update_menu().await {
|
|
Ok(_) => {
|
|
logging!(info, Type::Cmd, "Tray proxy selection synced successfully");
|
|
Ok(())
|
|
}
|
|
Err(e) => {
|
|
logging!(error, Type::Cmd, "Failed to sync tray proxy selection: {e}");
|
|
Err(e.to_string().into())
|
|
}
|
|
}
|
|
}
|