diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-04-05 17:35:59 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-04-05 17:53:09 +0200 |
commit | f28bfadf8d97bff7880dc3f7d28de3cb3bc18548 (patch) | |
tree | 68b31868e8d852d91bfe7883222cbf9e11f04452 /libimagrt | |
parent | ee61d079bdbf7713fad00289807d8be045624d29 (diff) |
logger: Print file and line on debug printing
Diffstat (limited to 'libimagrt')
-rw-r--r-- | libimagrt/src/logger.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libimagrt/src/logger.rs b/libimagrt/src/logger.rs index 181f3372..302d790a 100644 --- a/libimagrt/src/logger.rs +++ b/libimagrt/src/logger.rs @@ -26,7 +26,13 @@ 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 - writeln!(stderr(), "[imag][{: <5}]: {}", record.level(), record.args()).ok(); + 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(); + } } } } |