Browse Source

respect target argument

Aaron Feldstein 5 years ago
parent
commit
d7b7103071
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/lib.rs

+ 6 - 1
src/lib.rs

@@ -34,11 +34,16 @@ impl Log for SimpleLogger {
                     record.level().to_string()
                 }
             };
+            let target = if record.target().len() > 0 {
+                record.target()
+            } else {
+                record.module_path().unwrap_or_default()
+            };
             println!(
                 "{} {:<5} [{}] {}",
                 Local::now().format("%Y-%m-%d %H:%M:%S,%3f"),
                 level_string,
-                record.module_path().unwrap_or_default(),
+                target,
                 record.args());
         }
     }