option for date format default

master
Avril 4 years ago
parent cf2130d90a
commit ea54648b43
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,4 +1,8 @@
# Compilation time options for hotreload module. # Compilation time options for hotreload module.
[hot] [hot]
backlog = 100 backlog = 100
timeout = 5 timeout = 5
# Logging options
[log]
default_time_local = false

@ -7,6 +7,7 @@ use std::borrow::Cow;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub struct Config { pub struct Config {
pub hot: _Config__hot, pub hot: _Config__hot,
pub log: _Config__log,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -16,9 +17,18 @@ pub struct _Config__hot {
pub timeout: i64, pub timeout: i64,
} }
#[derive(Debug, Clone)]
#[allow(non_camel_case_types)]
pub struct _Config__log {
pub default_time_local: bool,
}
pub const CONFIG: Config = Config { pub const CONFIG: Config = Config {
hot: _Config__hot { hot: _Config__hot {
backlog: 100, backlog: 100,
timeout: 5, timeout: 5,
}, },
log: _Config__log {
default_time_local: false,
},
}; };

@ -54,6 +54,13 @@ pub mod build
static_assert!(TIMEOUT > 0); static_assert!(TIMEOUT > 0);
} }
pub mod log
{
pub use super::*;
pub const DEFAULT_LOCAL_TIME: bool = CONFIG.log.default_time_local;
}
/// Print the status of `build.toml` vars /// Print the status of `build.toml` vars
#[cfg(any(debug_assertions,feature="debug_logger"))] #[cfg(any(debug_assertions,feature="debug_logger"))]
pub fn stat() pub fn stat()

@ -15,6 +15,9 @@ use std::{
}; };
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
/// Print local time by default
const DEFAULT_USE_LOCAL_TIME: bool = crate::config::build::log::DEFAULT_LOCAL_TIME;
/// Logging level /// Logging level
#[derive(PartialEq,Copy,Eq,Debug,Clone,Hash,Ord,PartialOrd)] #[derive(PartialEq,Copy,Eq,Debug,Clone,Hash,Ord,PartialOrd)]
pub enum Level pub enum Level
@ -220,7 +223,7 @@ impl Logger
Self { Self {
level, level,
title: String::new(), title: String::new(),
use_local_time: false, use_local_time: DEFAULT_USE_LOCAL_TIME,
} }
} }

Loading…
Cancel
Save