Skip to content

Commit

Permalink
fix: spinners and log output no longer intermix
Browse files Browse the repository at this point in the history
- changed stderr logging to use a sync logger
  • Loading branch information
ericswanson-dfinity committed Jan 30, 2025
1 parent ec749ad commit 4c82f71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dfx/src/lib/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use indicatif::{MultiProgress, ProgressDrawTarget};
use slog::{Drain, Level, Logger, OwnedKVList, Record};
use std::fs::File;
use std::path::PathBuf;
use std::sync::Mutex;

/// The logging mode to use.
pub enum LoggingMode {
Expand Down Expand Up @@ -67,8 +68,8 @@ fn create_drain(mode: LoggingMode) -> Logger {
LoggingMode::Stderr => {
let decorator = slog_term::TermDecorator::new().build();
let drain = DfxFormat::new(decorator).fuse();
let async_drain = slog_async::Async::new(drain).build().fuse();
Logger::root(async_drain, slog::o!())
let mutex_drain = Mutex::new(drain).fuse();
Logger::root(mutex_drain, slog::o!())
}
LoggingMode::File(out) => {
let file = File::create(out).expect("Couldn't open log file");
Expand Down Expand Up @@ -119,7 +120,6 @@ pub fn create_root_logger(verbose_level: i64, mode: LoggingMode) -> (Logger, Mul
inner: drain,
spinners: spinners.clone(),
};
let drain = slog_async::Async::new(drain).build().fuse();
(
Logger::root(drain, slog::o!("version" => dfx_version_str())),
spinners,
Expand Down

0 comments on commit 4c82f71

Please sign in to comment.