Place date at the begining of the log file name

This commit is contained in:
Sylvain Migaud 2021-09-30 06:09:30 +00:00 committed by Imbris
parent 5da9f93ff7
commit 9b41568881
3 changed files with 7 additions and 4 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Made dungeon tiers 3, 4, and 5 more common
- Put date at the begining of the log file instead of the end to allow MIME type recognition
- Tweaked CR and exp calculation formula
### Removed

View File

@ -113,7 +113,7 @@ where
if let Some((path, file)) = log_path_file {
match fs::create_dir_all(path) {
Ok(_) => {
let file_appender = tracing_appender::rolling::daily(path, file);
let file_appender = tracing_appender::rolling::never(path, file); // It is actually rolling daily since the log name is changing daily
let (non_blocking_file, file_guard) = tracing_appender::non_blocking(file_appender);
guards.push(file_guard);
file_setup = true;

View File

@ -19,6 +19,7 @@ use veloren_voxygen::{
GlobalState,
};
use chrono::Utc;
#[cfg(feature = "hot-reloading")]
use common::assets;
use common::clock::Clock;
@ -39,8 +40,9 @@ fn main() {
.unwrap_or_else(|| userdata_dir.join("voxygen").join("logs"));
// Init logging and hold the guards.
const LOG_FILENAME: &str = "voxygen.log";
let _guards = common_frontend::init_stdout(Some((&logs_dir, LOG_FILENAME)));
let now = Utc::now();
let log_filename = format!("{}_voxygen.log", now.format("%Y-%m-%d"));
let _guards = common_frontend::init_stdout(Some((&logs_dir, &log_filename)));
info!("Using userdata dir at: {}", userdata_dir.display());
@ -117,7 +119,7 @@ fn main() {
Panic Payload: {:?}\n\
PanicInfo: {}\n\
Game version: {} [{}]",
logs_dir.join("voxygen.log.<date>").display(),
logs_dir.join(&log_filename).display(),
reason,
panic_info,
common::util::GIT_HASH.to_string(),