feat(log): add date to log file

This commit is contained in:
Songtronix 2019-10-15 16:06:37 +02:00 committed by Songtronix
parent bb64c8ed76
commit bdcea57201
4 changed files with 13 additions and 8 deletions

View File

@ -293,7 +293,7 @@ pub fn load_file(specifier: &str, endings: &[&str]) -> Result<BufReader<File>, E
let mut path = path.clone();
path.set_extension(ending);
debug!("Trying to access \"{:?}\"", path);
trace!("Trying to access \"{:?}\"", path);
if let Ok(file) = File::open(path) {
return Ok(BufReader::new(file));
}

View File

@ -49,7 +49,7 @@ serde = "1.0.102"
serde_derive = "1.0.102"
ron = "0.5.1"
guillotiere = { git = "https://github.com/Imberflur/guillotiere" }
simplelog = "0.7.4"
fern = { version = "0.5.8", features = ["colored"] }
msgbox = { version = "0.4.0", optional = true }
directories = "2.0.2"
num = "0.2.0"

View File

@ -134,11 +134,13 @@ fn main() {
.debug(Color::Green)
.trace(Color::BrightBlack);
let base = fern::Dispatch::new()
let base = fern::Dispatch::new()
.level_for("dot_vox::parser", log::LevelFilter::Warn)
.level_for("gfx_device_gl::factory", log::LevelFilter::Warn)
.level_for("veloren_voxygen::discord", log::LevelFilter::Warn)
.level_for("veloren_common::assets", log::LevelFilter::Warn);
.level_for("veloren_voxygen::discord", log::LevelFilter::Warn);
// TODO: Filter tracing better such that our own tracing gets seen more easily
let time = chrono::offset::Utc::now();
let file_cfg = fern::Dispatch::new()
.level(log::LevelFilter::Debug)
@ -155,7 +157,10 @@ fn main() {
message
))
})
.chain(fern::log_file("voxygen.log").expect("Failed to create log file!"));
.chain(
fern::log_file(&format!("voxygen-{}.log", time.format("%Y-%m-%d-%H")))
.expect("Failed to create log file!"),
);
let stdout_cfg = fern::Dispatch::new()
.level(term_log_level)

View File

@ -25,7 +25,7 @@ use common::{
vol::RectRasterableVol,
};
use hashbrown::HashMap;
use log::debug;
use log::trace;
use specs::{Entity as EcsEntity, Join};
use vek::*;
@ -902,7 +902,7 @@ impl FigureMgr {
renderer.render_figure(model, globals, locals, bone_consts, lights, shadows);
} else {
debug!("Body has no saved figure");
trace!("Body has no saved figure");
}
}
}