Use logger for plugin logs so they actually show

https://feedback.yaak.app/p/log-statements-dont-appear-from-within-plugins
This commit is contained in:
Gregory Schier
2025-08-08 13:00:38 -07:00
parent 158877b355
commit 5f99b7df05

View File

@@ -1,12 +1,12 @@
use crate::error::Result;
use log::info;
use log::{info, warn};
use serde;
use serde::Deserialize;
use std::net::SocketAddr;
use tauri::path::BaseDirectory;
use tauri::{AppHandle, Manager, Runtime};
use tauri_plugin_shell::process::CommandEvent;
use tauri_plugin_shell::ShellExt;
use tauri_plugin_shell::process::CommandEvent;
use tokio::sync::watch::Receiver;
#[derive(Deserialize, Default)]
@@ -44,10 +44,10 @@ pub async fn start_nodejs_plugin_runtime<R: Runtime>(
while let Some(event) = child_rx.recv().await {
match event {
CommandEvent::Stderr(line) => {
print!("{}", String::from_utf8(line).unwrap());
warn!("{}", String::from_utf8_lossy(&line).trim_end_matches(&['\n', '\r'][..]));
}
CommandEvent::Stdout(line) => {
print!("{}", String::from_utf8(line).unwrap());
info!("{}", String::from_utf8_lossy(&line).trim_end_matches(&['\n', '\r'][..]));
}
_ => {}
}