Skip to content

Commit

Permalink
fix: Log to stderr on non-android (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachariaszeiler committed Mar 6, 2024
1 parent 1aa24ad commit b64d3a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,6 @@ fn log_record(record: &Record) -> Result<(), Error> {
})
.and_then(|ts| ts.format(&DATE_TIME_FORMAT).map_err(|e| Error::Timestamp(e.to_string())))?;

println!("{} {} {} {} {}: {}", timestamp, pid, thread_id, priority, tag, message);
eprintln!("{} {} {} {} {}: {}", timestamp, pid, thread_id, priority, tag, message);
Ok(())
}
2 changes: 1 addition & 1 deletion src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl Log for LoggerImpl {
#[cfg(not(target_os = "android"))]
fn flush(&self) {
use std::io::Write;
io::stdout().flush().ok();
io::stderr().flush().ok();
}

#[cfg(target_os = "android")]
Expand Down

0 comments on commit b64d3a1

Please sign in to comment.