Skip to content

Commit

Permalink
Synchronize tracing color preference with scarb-ui stderr one
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kaput <[email protected]>
  • Loading branch information
mkaput committed Jan 19, 2024
1 parent 752adc8 commit c8119df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scarb/src/bin/scarb/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}
Expand Down

0 comments on commit c8119df

Please sign in to comment.