From 19b4238dcaea24bbef3d098db874d8439ee95357 Mon Sep 17 00:00:00 2001 From: Thinkofname Date: Mon, 21 Mar 2016 00:15:41 +0000 Subject: [PATCH] Filter hyper and mime from logs --- src/console/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/console/mod.rs b/src/console/mod.rs index 87112fc..4944654 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -24,6 +24,11 @@ use ui; use render; use format::{Component, TextComponent, Color}; +const FILTERED_CRATES: &'static [&'static str] = &[ + "hyper", + "mime", +]; + pub struct CVar { pub name: &'static str, pub ty: PhantomData, @@ -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(),