diff --git a/scarb/src/bin/scarb/main.rs b/scarb/src/bin/scarb/main.rs index 4b72ea26b..9e0de2893 100644 --- a/scarb/src/bin/scarb/main.rs +++ b/scarb/src/bin/scarb/main.rs @@ -21,6 +21,9 @@ mod errors; fn main() { let args = ScarbArgs::parse(); + // Pre-create Ui used in logging & error reporting, because we will move `args` to `cli_main`. + let ui = Ui::new(args.ui_verbosity(), args.output_format()); + tracing_subscriber::fmt() .with_writer(std::io::stderr) .with_env_filter( @@ -29,11 +32,9 @@ fn main() { .with_env_var("SCARB_LOG") .from_env_lossy(), ) + .with_ansi(ui.has_colors_enabled_stderr()) .init(); - // Pre-create Ui used in error reporting, because we will move `args` to `cli_main`. - let ui = Ui::new(args.ui_verbosity(), args.output_format()); - if let Err(err) = cli_main(args) { exit_with_error(err, &ui); }