Skip to content

Commit

Permalink
Log error messages to stderr
Browse files Browse the repository at this point in the history
When the log level is Error, print on stderr instead of stdout.

See <Genymobile#62>.
  • Loading branch information
rom1v committed Nov 30, 2017
1 parent 9a8ea15 commit c13d5f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion relay-rust/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ impl Log for SimpleLogger {
if self.enabled(record.metadata()) {
let date = Local::now();
let formatted_date = date.format("%Y-%m-%d %H:%M:%S%.3f");
println!(
let msg = format!(
"{} {} {}: {}",
formatted_date,
record.level(),
record.target(),
record.args()
);
if record.level() == LogLevel::Error {
eprintln!("{}", msg);
} else {
println!("{}", msg);
}
}
}
}
Expand Down

0 comments on commit c13d5f9

Please sign in to comment.