Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: spinners and log output no longer intermix #4090

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading