Merge pull request #322 from matthiasbeyer/libimagrt/debug-log-line-and-file

logger: Print file and line on debug printing
This commit is contained in:
Matthias Beyer 2016-04-06 16:58:22 +02:00
commit 3e9bf44127

View file

@ -26,8 +26,14 @@ impl Log for ImagLogger {
fn log(&self, record: &LogRecord) {
if self.enabled(record.metadata()) {
// TODO: This is just simple logging. Maybe we can enhance this lateron
if record.metadata().level() == LogLevel::Debug {
let loc = record.location();
writeln!(stderr(), "[imag][{: <5}][{}][{: >5}]: {}",
record.level(), loc.file(), loc.line(), record.args()).ok();
} else {
writeln!(stderr(), "[imag][{: <5}]: {}", record.level(), record.args()).ok();
}
}
}
}