-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(logging): use tracing instead of log4rs * feat(logging): use internal max files settings and reload logger whithout restart app * chore: cleanup and rm log4rs * chore: update scripts
- Loading branch information
1 parent
5a51834
commit 791baa5
Showing
18 changed files
with
380 additions
and
224 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
mod clash; | ||
mod core; | ||
mod draft; | ||
mod nyanpasu; | ||
mod prfitem; | ||
mod profiles; | ||
mod runtime; | ||
mod verge; | ||
|
||
pub use self::{clash::*, core::*, draft::*, prfitem::*, profiles::*, runtime::*, verge::*}; | ||
pub use self::{clash::*, core::*, draft::*, nyanpasu::*, prfitem::*, profiles::*, runtime::*}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use super::IVerge; | ||
use serde::{Deserialize, Serialize}; | ||
use tracing_subscriber::filter; | ||
#[derive(Deserialize, Serialize, Debug, Clone)] | ||
pub enum LoggingLevel { | ||
#[serde(rename = "silent", alias = "off")] | ||
Silent, | ||
#[serde(rename = "trace", alias = "tracing")] | ||
Trace, | ||
#[serde(rename = "debug")] | ||
Debug, | ||
#[serde(rename = "info")] | ||
Info, | ||
#[serde(rename = "warn", alias = "warning")] | ||
Warn, | ||
#[serde(rename = "error")] | ||
Error, | ||
} | ||
|
||
impl Default for LoggingLevel { | ||
#[cfg(debug_assertions)] | ||
fn default() -> Self { | ||
Self::Trace | ||
} | ||
|
||
#[cfg(not(debug_assertions))] | ||
fn default() -> Self { | ||
Self::Info | ||
} | ||
} | ||
|
||
impl From<LoggingLevel> for filter::LevelFilter { | ||
fn from(level: LoggingLevel) -> Self { | ||
match level { | ||
LoggingLevel::Silent => filter::LevelFilter::OFF, | ||
LoggingLevel::Trace => filter::LevelFilter::TRACE, | ||
LoggingLevel::Debug => filter::LevelFilter::DEBUG, | ||
LoggingLevel::Info => filter::LevelFilter::INFO, | ||
LoggingLevel::Warn => filter::LevelFilter::WARN, | ||
LoggingLevel::Error => filter::LevelFilter::ERROR, | ||
} | ||
} | ||
} | ||
|
||
impl IVerge { | ||
pub fn get_log_level(&self) -> LoggingLevel { | ||
self.app_log_level.clone().unwrap_or_default() | ||
} | ||
} |
Oops, something went wrong.