Refactor logging macros to remove print control parameter

- Updated logging macros to eliminate the boolean parameter for print control, simplifying the logging calls throughout the codebase.
- Adjusted all logging calls in various modules (lib.rs, lightweight.rs, help.rs, init.rs, logging.rs, resolve/mod.rs, resolve/scheme.rs, resolve/ui.rs, resolve/window.rs, server.rs, singleton.rs, window_manager.rs) to reflect the new macro structure.
- Ensured consistent logging behavior across the application by standardizing the logging format.
This commit is contained in:
Tunglies
2025-10-10 13:05:01 +08:00
parent a4d94c8bc9
commit 8c0af66ca9
33 changed files with 292 additions and 706 deletions

View File

@@ -139,7 +139,6 @@ pub async fn send_ipc_request(
logging!(
warn,
Type::Service,
true,
"IPC请求失败准备重试: 命令={}, 错误={}",
command_type,
e
@@ -165,7 +164,6 @@ pub async fn send_ipc_request(
logging!(
error,
Type::Service,
true,
"IPC请求最终失败重试已耗尽: 命令={}, 错误={}",
command_type,
e
@@ -204,12 +202,12 @@ async fn send_ipc_request_windows(
let mut pipe = match ClientOptions::new().open(IPC_SOCKET_NAME) {
Ok(p) => p,
Err(e) => {
logging!(error, Type::Service, true, "连接到服务命名管道失败: {}", e);
logging!(error, Type::Service, "连接到服务命名管道失败: {}", e);
return Err(anyhow::anyhow!("无法连接到服务命名管道: {}", e));
}
};
logging!(info, Type::Service, true, "服务连接成功 (Windows)");
logging!(info, Type::Service, "服务连接成功 (Windows)");
pipe.write_all(&len_bytes).await?;
pipe.write_all(request_bytes).await?;
@@ -226,7 +224,7 @@ async fn send_ipc_request_windows(
.map_err(|e| anyhow::anyhow!("解析响应失败: {}", e))?;
if !verify_response_signature(&response)? {
logging!(error, Type::Service, true, "服务响应签名验证失败");
logging!(error, Type::Service, "服务响应签名验证失败");
bail!("服务响应签名验证失败");
}
@@ -245,7 +243,7 @@ async fn send_ipc_request_unix(
let mut stream = match UnixStream::connect(IPC_SOCKET_NAME).await {
Ok(s) => s,
Err(e) => {
logging!(error, Type::Service, true, "连接到Unix套接字失败: {}", e);
logging!(error, Type::Service, "连接到Unix套接字失败: {}", e);
return Err(anyhow::anyhow!("无法连接到服务Unix套接字: {}", e));
}
};
@@ -269,7 +267,7 @@ async fn send_ipc_request_unix(
.map_err(|e| anyhow::anyhow!("解析响应失败: {}", e))?;
if !verify_response_signature(&response)? {
logging!(error, Type::Service, true, "服务响应签名验证失败");
logging!(error, Type::Service, "服务响应签名验证失败");
bail!("服务响应签名验证失败");
}