Change logging level from info to debug for hotkeys

This commit is contained in:
Tunglies 2025-04-05 09:19:44 +08:00
parent 6d1a8fb264
commit 55f1766ebc

View File

@ -30,7 +30,7 @@ impl Hotkey {
let enable_global_hotkey = verge.latest().enable_global_hotkey.unwrap_or(true); let enable_global_hotkey = verge.latest().enable_global_hotkey.unwrap_or(true);
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Initializing hotkeys with enable: {}", "Initializing hotkeys with enable: {}",
@ -44,7 +44,7 @@ impl Hotkey {
if let Some(hotkeys) = verge.latest().hotkeys.as_ref() { if let Some(hotkeys) = verge.latest().hotkeys.as_ref() {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Has {} hotkeys need to register", "Has {} hotkeys need to register",
@ -59,7 +59,7 @@ impl Hotkey {
match (key, func) { match (key, func) {
(Some(key), Some(func)) => { (Some(key), Some(func)) => {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Registering hotkey: {} -> {}", "Registering hotkey: {} -> {}",
@ -78,7 +78,7 @@ impl Hotkey {
); );
} else { } else {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Successfully registered hotkey {} -> {}", "Successfully registered hotkey {} -> {}",
@ -103,7 +103,7 @@ impl Hotkey {
} }
self.current.lock().clone_from(hotkeys); self.current.lock().clone_from(hotkeys);
} else { } else {
logging!(info, Type::Hotkey, true, "No hotkeys configured"); logging!(debug, Type::Hotkey, true, "No hotkeys configured");
} }
Ok(()) Ok(())
@ -121,7 +121,7 @@ impl Hotkey {
let manager = app_handle.global_shortcut(); let manager = app_handle.global_shortcut();
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Attempting to register hotkey: {} for function: {}", "Attempting to register hotkey: {} for function: {}",
@ -131,7 +131,7 @@ impl Hotkey {
if manager.is_registered(hotkey) { if manager.is_registered(hotkey) {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Hotkey {} was already registered, unregistering first", "Hotkey {} was already registered, unregistering first",
@ -143,14 +143,14 @@ impl Hotkey {
let f = match func.trim() { let f = match func.trim() {
"open_or_close_dashboard" => { "open_or_close_dashboard" => {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Registering open_or_close_dashboard function" "Registering open_or_close_dashboard function"
); );
|| { || {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"=== Hotkey Dashboard Window Operation Start ===" "=== Hotkey Dashboard Window Operation Start ==="
@ -159,7 +159,7 @@ impl Hotkey {
// 使用 spawn_blocking 来确保在正确的线程上执行 // 使用 spawn_blocking 来确保在正确的线程上执行
async_runtime::spawn_blocking(|| { async_runtime::spawn_blocking(|| {
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Toggle dashboard window visibility" "Toggle dashboard window visibility"
@ -193,7 +193,7 @@ impl Hotkey {
}); });
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"=== Hotkey Dashboard Window Operation End ===" "=== Hotkey Dashboard Window Operation End ==="
@ -220,18 +220,18 @@ impl Hotkey {
let _ = manager.on_shortcut(hotkey, move |app_handle, hotkey, event| { let _ = manager.on_shortcut(hotkey, move |app_handle, hotkey, event| {
if event.state == ShortcutState::Pressed { if event.state == ShortcutState::Pressed {
logging!(info, Type::Hotkey, true, "Hotkey pressed: {:?}", hotkey); logging!(debug, Type::Hotkey, true, "Hotkey pressed: {:?}", hotkey);
if hotkey.key == Code::KeyQ && is_quit { if hotkey.key == Code::KeyQ && is_quit {
if let Some(window) = app_handle.get_webview_window("main") { if let Some(window) = app_handle.get_webview_window("main") {
if window.is_focused().unwrap_or(false) { if window.is_focused().unwrap_or(false) {
logging!(info, Type::Hotkey, true, "Executing quit function"); logging!(debug, Type::Hotkey, true, "Executing quit function");
f(); f();
} }
} }
} else { } else {
// 直接执行函数,不做任何状态检查 // 直接执行函数,不做任何状态检查
logging!(info, Type::Hotkey, true, "Executing function directly"); logging!(debug, Type::Hotkey, true, "Executing function directly");
// 获取全局热键状态 // 获取全局热键状态
let is_enable_global_hotkey = Config::verge() let is_enable_global_hotkey = Config::verge()
@ -255,7 +255,7 @@ impl Hotkey {
}); });
logging!( logging!(
info, debug,
Type::Hotkey, Type::Hotkey,
true, true,
"Successfully registered hotkey {} for {}", "Successfully registered hotkey {} for {}",