feat: set max loglevel in logger configuration
This commit is contained in:
parent
619c2a4560
commit
e92a016d21
3 changed files with 32 additions and 9 deletions
|
@ -4,18 +4,19 @@ use crate::LogLevel;
|
|||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct LoggerConfig {
|
||||
pub(crate) log_level: LogLevel,
|
||||
pub(crate) log_level: Option<LogLevel>,
|
||||
pub(crate) log_to_file: bool,
|
||||
pub(crate) log_file_path: PathBuf,
|
||||
pub(crate) log_to_stdout: bool,
|
||||
pub(crate) stdout_color: bool,
|
||||
pub(crate) stdout_include_time: bool,
|
||||
pub(crate) file_include_time: bool,
|
||||
pub(crate) crate_max_level: Option<LogLevel>,
|
||||
}
|
||||
|
||||
impl LoggerConfig {
|
||||
pub fn level(mut self, level: LogLevel) -> Self {
|
||||
self.log_level = level;
|
||||
self.log_level = Some(level);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -53,7 +54,8 @@ impl LoggerConfig {
|
|||
impl Default for LoggerConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
log_level: LogLevel::Debug,
|
||||
log_level: None,
|
||||
crate_max_level: None,
|
||||
log_to_file: true,
|
||||
log_file_path: "app.log".into(),
|
||||
log_to_stdout: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue