mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
Squashed commit of the following:
commit 2a9f2f20e9c6d88c2f96fd40589740e1f236f64a
Author: Tunglies <77394545+Tunglies@users.noreply.github.com>
Date: Mon Oct 13 11:07:31 2025 +0800
fix: improve message handling in CommandEvent logging with CompactString
commit c77fc18accefeaf471594035d61bd13e235c87d6
Author: Tunglies <77394545+Tunglies@users.noreply.github.com>
Date: Mon Oct 13 10:47:16 2025 +0800
fix: optimize shared writer locking in CommandEvent handling
commit d5286ee5f1612f17b7a97eead84d430669816d98
Author: Tunglies <77394545+Tunglies@users.noreply.github.com>
Date: Mon Oct 13 10:30:19 2025 +0800
feat: integrate CompactString for improved logging and dependency management
commit 951fb2b120ce159c00dc57d43c5a519990f34cee
Author: Tunglies <77394545+Tunglies@users.noreply.github.com>
Date: Mon Oct 13 09:39:29 2025 +0800
refactor: remove write_sidecar_log function and streamline logging in CommandEvent handling
commit fd48d66c55a2c62fd32741fd3c65cc06d4cc693f
Author: Tunglies <77394545+Tunglies@users.noreply.github.com>
Date: Mon Oct 13 09:38:05 2025 +0800
Revert "refactor(core): stabilize 'static backing for sidecar logging"
This reverts commit fe7eb59f18.
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
use compact_str::CompactString;
|
||||
use flexi_logger::writers::FileLogWriter;
|
||||
use flexi_logger::writers::LogWriter;
|
||||
#[cfg(not(feature = "tauri-dev"))]
|
||||
use flexi_logger::{DeferredNow, filter::LogLineFilter};
|
||||
use log::Level;
|
||||
#[cfg(not(feature = "tauri-dev"))]
|
||||
use log::Record;
|
||||
use std::{fmt, sync::Arc};
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::{Mutex, MutexGuard};
|
||||
|
||||
pub type SharedWriter = Arc<Mutex<FileLogWriter>>;
|
||||
|
||||
@@ -134,6 +137,23 @@ macro_rules! logging_error {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn write_sidecar_log(
|
||||
writer: MutexGuard<'_, FileLogWriter>,
|
||||
now: &mut DeferredNow,
|
||||
level: Level,
|
||||
message: &CompactString,
|
||||
) {
|
||||
let args = format_args!("{}", message);
|
||||
|
||||
let record = Record::builder()
|
||||
.args(args)
|
||||
.level(level)
|
||||
.target("sidecar")
|
||||
.build();
|
||||
|
||||
let _ = writer.write(now, &record);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "tauri-dev"))]
|
||||
pub struct NoModuleFilter<'a>(pub &'a [&'a str]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user