logger: Print file and line on debug printing
This commit is contained in:
parent
ee61d079bd
commit
f28bfadf8d
1 changed files with 7 additions and 1 deletions
|
@ -26,8 +26,14 @@ impl Log for ImagLogger {
|
||||||
fn log(&self, record: &LogRecord) {
|
fn log(&self, record: &LogRecord) {
|
||||||
if self.enabled(record.metadata()) {
|
if self.enabled(record.metadata()) {
|
||||||
// TODO: This is just simple logging. Maybe we can enhance this lateron
|
// 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();
|
writeln!(stderr(), "[imag][{: <5}]: {}", record.level(), record.args()).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue