mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat(logging): introduce clash-verge-logging crate for management (#5486)
* feat(logging): introduce clash-verge-logging crate for management - Added a new crate `clash-verge-logging` with dependencies on `log`, `tokio`, `compact_str`, and `flexi_logger`. - Implemented logging types and macros for structured logging across the application. - Replaced existing logging imports with the new `clash_verge_logging` crate in various modules. - Updated logging functionality to support different logging types and error handling. - Refactored code to improve logging consistency and maintainability. * fix(logging): update import paths for clash_verge_logging in linux.rs and dns.rs * fix(logging): update import statement for clash_verge_logging in windows.rs
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
use crate::constants::files::DNS_CONFIG;
|
||||
use crate::{
|
||||
config::Config,
|
||||
logging,
|
||||
process::AsyncHandler,
|
||||
utils::{dirs, logging::Type},
|
||||
};
|
||||
use crate::{config::Config, process::AsyncHandler, utils::dirs};
|
||||
use anyhow::Error;
|
||||
use arc_swap::{ArcSwap, ArcSwapOption};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use once_cell::sync::OnceCell;
|
||||
use reqwest_dav::list_cmd::{ListEntity, ListFile};
|
||||
use smartstring::alias::String;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use crate::process::AsyncHandler;
|
||||
use crate::utils::notification::{NotificationEvent, notify_event};
|
||||
use crate::{
|
||||
config::Config, core::handle, feat, logging, module::lightweight::entry_lightweight_mode,
|
||||
singleton_with_logging, utils::logging::Type,
|
||||
config::Config, core::handle, feat, module::lightweight::entry_lightweight_mode,
|
||||
singleton_with_logging,
|
||||
};
|
||||
use anyhow::{Result, bail};
|
||||
use arc_swap::ArcSwap;
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use smartstring::alias::String;
|
||||
use std::{collections::HashMap, fmt, str::FromStr, sync::Arc};
|
||||
use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt as _, ShortcutState};
|
||||
|
||||
@@ -3,10 +3,10 @@ use crate::{
|
||||
config::{Config, ConfigType, IRuntime},
|
||||
constants::timing,
|
||||
core::{handle, validate::CoreConfigValidator},
|
||||
logging,
|
||||
utils::{dirs, help, logging::Type},
|
||||
utils::{dirs, help},
|
||||
};
|
||||
use anyhow::{Result, anyhow};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use smartstring::alias::String;
|
||||
use std::{path::PathBuf, time::Instant};
|
||||
use tauri_plugin_mihomo::Error as MihomoError;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
use super::{CoreManager, RunningMode};
|
||||
use crate::cmd::StringifyErr as _;
|
||||
use crate::config::{Config, IVerge};
|
||||
use crate::{
|
||||
core::{
|
||||
logger::CLASH_LOGGER,
|
||||
service::{SERVICE_MANAGER, ServiceStatus},
|
||||
},
|
||||
logging,
|
||||
utils::logging::Type,
|
||||
use crate::core::{
|
||||
logger::CLASH_LOGGER,
|
||||
service::{SERVICE_MANAGER, ServiceStatus},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use smartstring::alias::String;
|
||||
|
||||
impl CoreManager {
|
||||
|
||||
@@ -5,13 +5,10 @@ use crate::{
|
||||
core::{handle, logger::CLASH_LOGGER, service},
|
||||
logging,
|
||||
process::CommandChildGuard,
|
||||
utils::{
|
||||
dirs,
|
||||
init::sidecar_writer,
|
||||
logging::{SharedWriter, Type, write_sidecar_log},
|
||||
},
|
||||
utils::{dirs, init::sidecar_writer},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use clash_verge_logging::{SharedWriter, Type, write_sidecar_log};
|
||||
use compact_str::CompactString;
|
||||
use flexi_logger::DeferredNow;
|
||||
use log::Level;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use super::handle::Handle;
|
||||
use crate::{
|
||||
constants::{retry, timing},
|
||||
logging,
|
||||
utils::logging::Type,
|
||||
};
|
||||
use crate::constants::{retry, timing};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use parking_lot::RwLock;
|
||||
use smartstring::alias::String;
|
||||
use std::{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
config::Config,
|
||||
core::tray,
|
||||
logging, logging_error,
|
||||
utils::{dirs, init::service_writer_config, logging::Type},
|
||||
utils::{dirs, init::service_writer_config},
|
||||
};
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use clash_verge_logging::{Type, logging, logging_error};
|
||||
use clash_verge_service_ipc::CoreConfig;
|
||||
use compact_str::CompactString;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
@@ -3,10 +3,10 @@ use crate::utils::autostart as startup_shortcut;
|
||||
use crate::{
|
||||
config::{Config, IVerge},
|
||||
core::handle::Handle,
|
||||
logging, logging_error, singleton_lazy,
|
||||
utils::logging::Type,
|
||||
singleton_lazy,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use clash_verge_logging::{Type, logging, logging_error};
|
||||
use parking_lot::RwLock;
|
||||
use scopeguard::defer;
|
||||
use smartstring::alias::String;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
config::Config,
|
||||
core::{CoreManager, manager::RunningMode, sysopt::Sysopt},
|
||||
feat, logging, logging_error, singleton,
|
||||
utils::logging::Type,
|
||||
feat, singleton,
|
||||
};
|
||||
use anyhow::{Context as _, Result};
|
||||
use clash_verge_logging::{Type, logging, logging_error};
|
||||
use delay_timer::prelude::{DelayTimer, DelayTimerBuilder, TaskBuilder};
|
||||
use parking_lot::RwLock;
|
||||
use smartstring::alias::String;
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::config::{Config, ConfigType};
|
||||
use crate::core::handle;
|
||||
use crate::singleton_lazy;
|
||||
use crate::utils::dirs;
|
||||
use crate::{logging, utils::logging::Type};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
|
||||
pub struct CoreConfigValidator {
|
||||
is_processing: AtomicBool,
|
||||
|
||||
Reference in New Issue
Block a user