mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'songtronix/fix-logging' into 'master'
fix logging Closes #317 and #318 See merge request veloren/veloren!589
This commit is contained in:
commit
b804c18eb0
751
Cargo.lock
generated
751
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,7 @@ impl Client {
|
||||
let map_size = Vec2::new(1024, 1024);
|
||||
let world_map_raw = vec![0u8; 4 * /*world_map.len()*/map_size.x * map_size.y];
|
||||
// LittleEndian::write_u32_into(&world_map, &mut world_map_raw);
|
||||
log::info!("Preparing image...");
|
||||
log::debug!("Preparing image...");
|
||||
let world_map = Arc::new(image::DynamicImage::ImageRgba8({
|
||||
// Should not fail if the dimensions are correct.
|
||||
let world_map = image::ImageBuffer::from_raw(
|
||||
@ -114,7 +114,7 @@ impl Client {
|
||||
);
|
||||
world_map.ok_or(Error::Other("Server sent a bad world map image".into()))?
|
||||
}));
|
||||
log::info!("Done preparing image...");
|
||||
log::debug!("Done preparing image...");
|
||||
|
||||
(state, entity, server_info, world_map)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ lz4-compress = "0.1.1"
|
||||
hashbrown = { version = "0.6.2", features = ["serde", "nightly"] }
|
||||
find_folder = "0.3.0"
|
||||
parking_lot = "0.9.0"
|
||||
crossbeam = "0.7.2"
|
||||
crossbeam = "=0.7.2"
|
||||
notify = "5.0.0-pre.1"
|
||||
indexmap = "1.3.0"
|
||||
# TODO: remove when upgrading to specs 0.15
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ serde_derive = "1.0.102"
|
||||
rand = "0.7.2"
|
||||
chrono = "0.4.9"
|
||||
hashbrown = { version = "0.6.2", features = ["serde", "nightly"] }
|
||||
crossbeam = "0.7.2"
|
||||
crossbeam = "=0.7.2"
|
||||
prometheus = "0.7"
|
||||
prometheus-static-metric = "0.2"
|
||||
rouille = "3.0.0"
|
||||
|
@ -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"
|
||||
@ -59,7 +59,7 @@ frustum_query = "0.1.2"
|
||||
# context for pinning to commit: https://gitlab.com/veloren/veloren/issues/280
|
||||
rodio = { git = "https://github.com/RustAudio/rodio", rev = "e5474a2"}
|
||||
cpal = "0.10"
|
||||
crossbeam = "0.7.2"
|
||||
crossbeam = "=0.7.2"
|
||||
hashbrown = { version = "0.6.2", features = ["serde", "nightly"] }
|
||||
chrono = "0.4.9"
|
||||
rust-argon2 = "0.5"
|
||||
|
@ -35,8 +35,8 @@ pub use crate::error::Error;
|
||||
use crate::{audio::AudioFrontend, menu::main::MainMenuState, settings::Settings, window::Window};
|
||||
use log::{self, debug, error, info};
|
||||
|
||||
use simplelog::{CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger};
|
||||
use std::{fs::File, mem, panic, str::FromStr};
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
use std::{mem, panic, str::FromStr};
|
||||
|
||||
/// A type used to store state that is shared between all play states.
|
||||
pub struct GlobalState {
|
||||
@ -126,15 +126,57 @@ fn main() {
|
||||
.and_then(|env| env.to_str().map(|s| s.to_owned()))
|
||||
.and_then(|s| log::LevelFilter::from_str(&s).ok())
|
||||
.unwrap_or(log::LevelFilter::Warn);
|
||||
CombinedLogger::init(vec![
|
||||
TermLogger::new(term_log_level, Config::default(), TerminalMode::Mixed).unwrap(),
|
||||
WriteLogger::new(
|
||||
log::LevelFilter::Info,
|
||||
Config::default(),
|
||||
File::create(&settings.log.file).unwrap(),
|
||||
),
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let colors = ColoredLevelConfig::new()
|
||||
.error(Color::Red)
|
||||
.warn(Color::Yellow)
|
||||
.info(Color::Cyan)
|
||||
.debug(Color::Green)
|
||||
.trace(Color::BrightBlack);
|
||||
|
||||
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);
|
||||
// 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::Trace)
|
||||
.format(|out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}:{}][{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
record.target(),
|
||||
record
|
||||
.line()
|
||||
.map(|x| x.to_string())
|
||||
.unwrap_or("X".to_string()),
|
||||
record.level(),
|
||||
message
|
||||
))
|
||||
})
|
||||
.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)
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"[{}] {}",
|
||||
colors.color(record.level()),
|
||||
message
|
||||
))
|
||||
})
|
||||
.chain(std::io::stdout());
|
||||
|
||||
base.chain(file_cfg)
|
||||
.chain(stdout_cfg)
|
||||
.apply()
|
||||
.expect("Failed to setup logging!");
|
||||
|
||||
// Set up panic handler to relay swish panic messages to the user
|
||||
let settings_clone = settings.clone();
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user