mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
fix: more readable timestamp format for logging (#1912)
* Use more readable timestamp format for logging * Add logging level highlighting * Change date and time format to YYYYMMDD from MM-DD
This commit is contained in:
parent
d23dec73d0
commit
40d727a01c
1 changed files with 5 additions and 3 deletions
|
@ -54,6 +54,8 @@ lazy_static! {
|
||||||
static ref LOGGING_CONFIG: Mutex<LoggingConfig> = Mutex::new(LoggingConfig::default());
|
static ref LOGGING_CONFIG: Mutex<LoggingConfig> = Mutex::new(LoggingConfig::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LOGGING_PATTERN: &str = "{d(%Y%m%d %H:%M:%S%.3f)} {h({l})} {M} - {m}{n}";
|
||||||
|
|
||||||
/// This filter is rejecting messages that doesn't start with "grin"
|
/// This filter is rejecting messages that doesn't start with "grin"
|
||||||
/// in order to save log space for only Grin-related records
|
/// in order to save log space for only Grin-related records
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -97,7 +99,7 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
|
|
||||||
// Start logger
|
// Start logger
|
||||||
let stdout = ConsoleAppender::builder()
|
let stdout = ConsoleAppender::builder()
|
||||||
.encoder(Box::new(PatternEncoder::default()))
|
.encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut root = Root::builder();
|
let mut root = Root::builder();
|
||||||
|
@ -132,7 +134,7 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
Box::new(
|
Box::new(
|
||||||
RollingFileAppender::builder()
|
RollingFileAppender::builder()
|
||||||
.append(c.log_file_append)
|
.append(c.log_file_append)
|
||||||
.encoder(Box::new(PatternEncoder::new("{d} {l} {M} - {m}{n}")))
|
.encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN)))
|
||||||
.build(c.log_file_path, Box::new(policy))
|
.build(c.log_file_path, Box::new(policy))
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
|
@ -140,7 +142,7 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
Box::new(
|
Box::new(
|
||||||
FileAppender::builder()
|
FileAppender::builder()
|
||||||
.append(c.log_file_append)
|
.append(c.log_file_append)
|
||||||
.encoder(Box::new(PatternEncoder::new("{d} {l} {M} - {m}{n}")))
|
.encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN)))
|
||||||
.build(c.log_file_path)
|
.build(c.log_file_path)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue