fix date string, simple FileRotate object

This commit is contained in:
jb-alvarado 2022-05-12 17:57:15 +02:00
parent 4b0a3f5b1a
commit 52f7d97ca6
2 changed files with 13 additions and 15 deletions

View File

@ -134,7 +134,7 @@ impl ProcessControl {
rpc.clone().close()
};
for unit in [Encoder, Decoder, Ingest] {
for unit in [Decoder, Encoder, Ingest] {
if let Err(e) = self.kill(unit) {
error!("{e}")
}

View File

@ -169,7 +169,7 @@ pub fn init_logging() -> Vec<Box<dyn SharedLogger>> {
let file_config = log_config
.clone()
.set_time_format_custom(format_description!(
"[[year]-[month]-[day] [hour]:[minute]:[second].[subsecond digits:5]]"
"[[[year]-[month]-[day] [hour]:[minute]:[second].[subsecond digits:5]]"
))
.build();
let mut log_path = "logs/ffplayout.log".to_string();
@ -185,20 +185,18 @@ pub fn init_logging() -> Vec<Box<dyn SharedLogger>> {
println!("Logging path not exists!")
}
let log = || {
FileRotate::new(
log_path,
AppendTimestamp::with_format(
"%Y-%m-%d",
FileLimit::MaxFiles(app_config.backup_count),
DateFrom::DateYesterday,
),
ContentLimit::Time(TimeFrequency::Daily),
Compression::None,
)
};
let log_file = FileRotate::new(
&log_path,
AppendTimestamp::with_format(
"%Y-%m-%d",
FileLimit::MaxFiles(app_config.backup_count),
DateFrom::DateYesterday,
),
ContentLimit::Time(TimeFrequency::Daily),
Compression::None,
);
app_logger.push(WriteLogger::new(LevelFilter::Debug, file_config, log()));
app_logger.push(WriteLogger::new(LevelFilter::Debug, file_config, log_file));
} else {
let term_config = log_config
.clone()