Filter hyper and mime from logs

This commit is contained in:
Thinkofname 2016-03-21 00:15:41 +00:00
parent ae2703418b
commit 19b4238dca
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,11 @@ use ui;
use render;
use format::{Component, TextComponent, Color};
const FILTERED_CRATES: &'static [&'static str] = &[
"hyper",
"mime",
];
pub struct CVar<T: Sized + Any + 'static> {
pub name: &'static str,
pub ty: PhantomData<T>,
@ -226,10 +231,17 @@ impl Console {
}
fn log(&mut self, record: &log::LogRecord) {
for filtered in FILTERED_CRATES {
if record.location().module_path().starts_with(filtered) {
return;
}
}
let mut file = &record.location().file().replace("\\", "/")[..];
if let Some(pos) = file.rfind("src/") {
file = &file[pos + 4..];
}
println!("[{}:{}][{}] {}",
file,
record.location().line(),