aboutsummaryrefslogtreecommitdiff
path: root/src/logging.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-01-23 08:39:16 -0800
committerJoe Wilm <jwilm@users.noreply.github.com>2017-01-23 09:14:01 -0800
commitdb5f65637a0b061713b23c7ce5c1976f55ad8d83 (patch)
tree455aed9b1e2ca87ef5d0fd29ca6b8c9c05577cfd /src/logging.rs
parent64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968 (diff)
downloadalacritty-db5f65637a0b061713b23c7ce5c1976f55ad8d83.tar.gz
alacritty-db5f65637a0b061713b23c7ce5c1976f55ad8d83.zip
Changes to Logger logic
The logger implementation will now only show items from Alacritty. Additionally, the module info is omitted from the log output. If the origin of a log item must be found, it can easily be grepped for.
Diffstat (limited to 'src/logging.rs')
-rw-r--r--src/logging.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/logging.rs b/src/logging.rs
index e4ebf13f..9037cbe9 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -41,17 +41,12 @@ impl<T> log::Log for Logger<T> where T:Send+io::Write {
}
fn log(&self, record: &log::LogRecord) {
- if !self.enabled(record.metadata()) {
- return
- }
- let writer = &mut self.output.lock().unwrap();
- if self.level < log::LogLevelFilter::Debug {
- writer.write(format!("{}\n", record.args()).as_ref()).unwrap();
- } else {
- writer.write(format!("{}: {}\n",
- record.target(),
- record.args())
- .as_ref()).unwrap();
+ if self.enabled(record.metadata()) {
+ if record.target().starts_with("alacritty") {
+ if let Ok(ref mut writer) = self.output.lock() {
+ let _ = writer.write(format!("{}\n", record.args()).as_ref());
+ }
+ }
}
}
}