mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-15 15:32:21 +08:00
fix: failed to receive shutdown signal on windows (#5533)
* fix: receive shutdown signal failed on windows * docs: update Changelog.md * chore: update * fix: use tokio runtime to handle shutdown signal * docs: update Changelog.md * fix: move tauri dependency to the correct section in Cargo.toml * fix: remove unused exit handling code in run function * fix(clash-verge-signal): use global runtime to avoid tokio runtime panic on unix * chore: update tauri-plugin-mihomo deps * fix: handle macOS exit event to ensure proper application termination --------- Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@ use clash_verge_service_ipc::WriterConfig;
|
||||
use flexi_logger::writers::FileLogWriter;
|
||||
use flexi_logger::{Cleanup, Criterion, FileSpec};
|
||||
#[cfg(not(feature = "tauri-dev"))]
|
||||
use flexi_logger::{Duplicate, LogSpecBuilder, Logger};
|
||||
use flexi_logger::{Duplicate, LogSpecBuilder, Logger, LoggerHandle};
|
||||
use std::{path::PathBuf, str::FromStr as _};
|
||||
use tauri_plugin_shell::ShellExt as _;
|
||||
use tokio::fs;
|
||||
@@ -27,7 +27,7 @@ use tokio::fs::DirEntry;
|
||||
|
||||
/// initialize this instance's log file
|
||||
#[cfg(not(feature = "tauri-dev"))]
|
||||
pub async fn init_logger() -> Result<()> {
|
||||
pub async fn init_logger() -> Result<LoggerHandle> {
|
||||
// TODO 提供 runtime 级别实时修改
|
||||
let (log_level, log_max_size, log_max_count) = {
|
||||
let verge_guard = Config::verge().await;
|
||||
@@ -47,11 +47,9 @@ pub async fn init_logger() -> Result<()> {
|
||||
.unwrap_or(log_level);
|
||||
spec.default(level);
|
||||
#[cfg(feature = "tracing")]
|
||||
spec.module("tauri", log::LevelFilter::Debug);
|
||||
#[cfg(feature = "tracing")]
|
||||
spec.module("wry", log::LevelFilter::Off);
|
||||
#[cfg(feature = "tracing")]
|
||||
spec.module("tauri_plugin_mihomo", log::LevelFilter::Off);
|
||||
spec.module("tauri", log::LevelFilter::Debug)
|
||||
.module("wry", log::LevelFilter::Off)
|
||||
.module("tauri_plugin_mihomo", log::LevelFilter::Off);
|
||||
let spec = spec.build();
|
||||
|
||||
let logger = Logger::with(spec)
|
||||
@@ -83,14 +81,14 @@ pub async fn init_logger() -> Result<()> {
|
||||
"kode_bridge",
|
||||
])));
|
||||
|
||||
let _handle = logger.start()?;
|
||||
let handle = logger.start()?;
|
||||
|
||||
// TODO 全局 logger handle 控制
|
||||
// GlobalLoggerProxy::global().set_inner(handle);
|
||||
// TODO 提供前端设置等级,热更新等级
|
||||
// logger.parse_new_spec(spec)
|
||||
|
||||
Ok(())
|
||||
Ok(handle)
|
||||
}
|
||||
|
||||
pub async fn sidecar_writer() -> Result<FileLogWriter> {
|
||||
|
||||
Reference in New Issue
Block a user