Repository: osa1/tiny (language: rust)

Issue:
Debug logs should mention line numbers
Currently a debug log looks like this:

```
[2020-06-02T06:05:11Z DEBUG libtiny_logger] Trying to open log file: "/home/omer/tiny_logs/mentions.txt"
```

It'd be good to see the line numbers here as well. Should be a matter of overriding the formatter used by the `env_logger` crate. Here's an example of how it might look like with the line number:

```
[2020-06-02T06:05:11Z DEBUG libtiny_logger:123] Trying to open log file: "/home/omer/tiny_logs/mentions.txt"
```


Discussion / hints:

Fix patch:
diff --git a/tiny/src/main.rs b/tiny/src/main.rs
index 1d197b7d..2caaec1f 100644
--- a/tiny/src/main.rs
+++ b/tiny/src/main.rs
@@ -15,6 +15,7 @@ use libtiny_logger::Logger;
 use libtiny_tui::{MsgTarget, TUI};
 use libtiny_ui::UI;
 
+use std::io::Write;
 use std::path::PathBuf;
 use std::process::exit;
 
@@ -75,6 +76,19 @@ fn run(
 ) {
     env_logger::builder()
         .target(env_logger::Target::Stderr)
+        .format(|buf, record| {
+            let timestamp = buf.timestamp_seconds();
+
+            writeln!(
+                buf,
+                "[{}] {} [{}:{}] {}",
+                timestamp,
+                record.level(),
+                record.file().unwrap_or_default(),
+                record.line().unwrap_or_default(),
+                record.args()
+            )
+        })
         .init();
 
     // One task for each client to handle IRC events


Test patch: