Skip to content

Commit

Permalink
feat(cli): retain log verbosity when running a mobile IDE script (#11186
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lucasfernog authored Oct 2, 2024
1 parent 11e9f2e commit 6cfe7ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changes/ide-commands-verbosity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'tauri-cli': 'patch:enhance'
'@tauri-apps/cli': 'patch:enhance'
---

Retain logger verbosity on the `android-studio-script` and `xcode-script` commands.

9 changes: 8 additions & 1 deletion crates/tauri-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,17 @@ where
Err(e) => e.exit(),
};

let verbosity_number = std::env::var("TAURI_CLI_VERBOSITY")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(cli.verbose);
// set the verbosity level so subsequent CLI calls (xcode-script, android-studio-script) refer to it
std::env::set_var("TAURI_CLI_VERBOSITY", verbosity_number.to_string());

let mut builder = Builder::from_default_env();
let init_res = builder
.format_indent(Some(12))
.filter(None, verbosity_level(cli.verbose).to_level_filter())
.filter(None, verbosity_level(verbosity_number).to_level_filter())
.format(|f, record| {
let mut is_command_output = false;
if let Some(action) = record.key_values().get("action".into()) {
Expand Down

0 comments on commit 6cfe7ed

Please sign in to comment.