Skip to content

Commit

Permalink
feat: change logger to log the target file
Browse files Browse the repository at this point in the history
  • Loading branch information
SkuldNorniern committed Nov 16, 2024
1 parent 00a660d commit edf54e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ impl Log for Logger {
}

fn log(&self, record: &Record) {
// Y M S, H:M:S Timezone
let timestamp = Local::now().format("%Y-%m-%d %H:%M:%S %z").to_string();
let formatted_message = format!("[{}] [{}]: {}", timestamp, record.level(), record.args());
let formatted_message = format!(
"[{}] [{}] [{}:{}]: {}",
timestamp,
record.level(),
record.file().unwrap_or("unknown"),
record.line().unwrap_or(0),
record.args()
);

if self.write_to_std.as_ref().is_some() && record.level() <= self.severity {
match self.write_to_std.as_ref().unwrap() {
Expand Down

0 comments on commit edf54e0

Please sign in to comment.