-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [#936] rename config value log_level to threshold
From: ```toml [logging] log_level = "info" ``` To: ```toml [logging] threshold = "info" ``` Threshold represetns better the concept since this value is the security level at which the app stops collecting logs, meaning it filters out logs with a lower security level.
- Loading branch information
1 parent
b66adcc
commit af61e20
Showing
11 changed files
with
53 additions
and
52 deletions.
There are no files selected for viewing
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,26 +1,41 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::LogLevel; | ||
|
||
#[allow(clippy::struct_excessive_bools)] | ||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] | ||
pub struct Logging { | ||
/// Logging level. Possible values are: `Off`, `Error`, `Warn`, `Info`, | ||
/// `Debug` and `Trace`. Default is `Info`. | ||
#[serde(default = "Logging::default_log_level")] | ||
pub log_level: LogLevel, | ||
#[serde(default = "Logging::default_threshold")] | ||
pub threshold: Threshold, | ||
} | ||
|
||
impl Default for Logging { | ||
fn default() -> Self { | ||
Self { | ||
log_level: Self::default_log_level(), | ||
threshold: Self::default_threshold(), | ||
} | ||
} | ||
} | ||
|
||
impl Logging { | ||
fn default_log_level() -> LogLevel { | ||
LogLevel::Info | ||
fn default_threshold() -> Threshold { | ||
Threshold::Info | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Clone)] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum Threshold { | ||
/// A threshold lower than all security levels. | ||
Off, | ||
/// Corresponds to the `Error` security level. | ||
Error, | ||
/// Corresponds to the `Warn` security level. | ||
Warn, | ||
/// Corresponds to the `Info` security level. | ||
Info, | ||
/// Corresponds to the `Debug` security level. | ||
Debug, | ||
/// Corresponds to the `Trace` security level. | ||
Trace, | ||
} |
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,5 +1,5 @@ | ||
[logging] | ||
log_level = "error" | ||
threshold = "error" | ||
|
||
[core] | ||
remove_peerless_torrents = false | ||
|
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
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