chore: replace println! to info! (#236)

This commit is contained in:
RainbowBird
2025-06-28 01:09:47 +08:00
committed by GitHub
parent 581bae28c6
commit 9f30407fc7
3 changed files with 17 additions and 14 deletions
@@ -1,3 +1,4 @@
use log::debug;
use tauri::Manager;
use crate::app_windows;
@@ -28,6 +29,6 @@ pub async fn open_chat_window(app: tauri::AppHandle) -> Result<(), tauri::Error>
#[tauri::command]
pub fn debug_println(msg: serde_json::Value) -> Result<(), tauri::Error> {
println!("{msg}");
debug!("{msg}");
Ok(())
}
+5 -4
View File
@@ -1,5 +1,6 @@
use std::{sync::atomic::Ordering, time::Duration};
use log::info;
use tauri::{
Emitter,
Manager,
@@ -106,11 +107,11 @@ fn load_whisper_model() -> Result<whisper::WhisperProcessor, anyhow::Error> {
candle_core::Device::Cpu
};
println!("Using device: {device:?}");
info!("Using device: {device:?}");
let whisper_model = whisper::WhichWhisperModel::Tiny;
println!("Loading whisper model: {:?}", whisper_model);
info!("Loading whisper model: {:?}", whisper_model);
let model = whisper::WhisperProcessor::new(whisper_model, device.clone())?;
Ok(model)
@@ -235,8 +236,8 @@ pub fn run() {
.expect("error while building tauri application")
.run(|_, event| {
if let RunEvent::ExitRequested { .. } = event {
println!("Exiting app");
println!("Exited app");
info!("Exiting app");
info!("Exited app");
}
});
}
+10 -9
View File
@@ -1,5 +1,6 @@
use std::process::Stdio;
use log::info;
use rmcp::{
model::{CallToolRequestParam, CallToolResult, Tool},
service::RunningService,
@@ -23,7 +24,7 @@ pub struct McpState {
#[allow(clippy::missing_panics_doc)]
pub fn destroy<R: Runtime>(app_handle: &AppHandle<R>) {
println!("Destroying MCP plugin");
info!("Destroying MCP plugin");
tokio::runtime::Runtime::new()
.unwrap()
@@ -32,7 +33,7 @@ pub fn destroy<R: Runtime>(app_handle: &AppHandle<R>) {
let mut state = state.lock().await;
if state.client.is_none() {
println!("MCP plugin not connected, no need to disconnect");
info!("MCP plugin not connected, no need to disconnect");
return;
}
@@ -43,7 +44,7 @@ pub fn destroy<R: Runtime>(app_handle: &AppHandle<R>) {
// client.waiting().await.unwrap();
});
println!("MCP plugin destroyed");
info!("MCP plugin destroyed");
}
#[tauri::command]
@@ -82,11 +83,11 @@ async fn disconnect_server(state: State<'_, Mutex<McpState>>) -> Result<(), Stri
}
let cancel_result = state.client.take().unwrap().cancel().await;
println!("Cancel result: {cancel_result:?}");
info!("Cancel result: {cancel_result:?}");
// state.client.take().unwrap().waiting().await.unwrap();
drop(state);
println!("Disconnected from MCP server");
info!("Disconnected from MCP server");
Ok(())
}
@@ -116,8 +117,8 @@ async fn call_tool(
name: String,
args: Option<Map<String, Value>>,
) -> Result<CallToolResult, String> {
println!("Calling tool: {name:?}");
println!("Arguments: {args:?}");
info!("Calling tool: {name:?}");
info!("Arguments: {args:?}");
let state = state.lock().await;
let client = state.client.as_ref();
@@ -135,7 +136,7 @@ async fn call_tool(
.unwrap();
drop(state);
println!("Tool result: {call_tool_result:?}");
info!("Tool result: {call_tool_result:?}");
Ok(call_tool_result)
}
@@ -146,7 +147,7 @@ pub struct Builder;
impl Builder {
#[must_use]
pub fn build<R: Runtime>(self) -> TauriPlugin<R> {
println!("Building MCP plugin");
info!("Building MCP plugin");
plugin::Builder::new("mcp")
.invoke_handler(tauri::generate_handler![