Filter hyper and mime from logs
This commit is contained in:
parent
ae2703418b
commit
19b4238dca
|
@ -24,6 +24,11 @@ use ui;
|
||||||
use render;
|
use render;
|
||||||
use format::{Component, TextComponent, Color};
|
use format::{Component, TextComponent, Color};
|
||||||
|
|
||||||
|
const FILTERED_CRATES: &'static [&'static str] = &[
|
||||||
|
"hyper",
|
||||||
|
"mime",
|
||||||
|
];
|
||||||
|
|
||||||
pub struct CVar<T: Sized + Any + 'static> {
|
pub struct CVar<T: Sized + Any + 'static> {
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub ty: PhantomData<T>,
|
pub ty: PhantomData<T>,
|
||||||
|
@ -226,10 +231,17 @@ impl Console {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn log(&mut self, record: &log::LogRecord) {
|
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("\\", "/")[..];
|
let mut file = &record.location().file().replace("\\", "/")[..];
|
||||||
if let Some(pos) = file.rfind("src/") {
|
if let Some(pos) = file.rfind("src/") {
|
||||||
file = &file[pos + 4..];
|
file = &file[pos + 4..];
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("[{}:{}][{}] {}",
|
println!("[{}:{}][{}] {}",
|
||||||
file,
|
file,
|
||||||
record.location().line(),
|
record.location().line(),
|
||||||
|
|
Loading…
Reference in New Issue