feat(cli): retain log verbosity when running a mobile IDE script (#11186)

This commit is contained in:
Lucas Fernandes Nogueira
2024-10-01 21:58:54 -03:00
committed by GitHub
parent 11e9f2eb83
commit 6cfe7edf63
2 changed files with 15 additions and 1 deletions

View File

@@ -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.

View File

@@ -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()) {