[pve-devel] [PATCH proxmox-backup 3/3] file-restore: set loglevel considering PBS_QEMU_DEBUG

Stoiko Ivanov s.ivanov at proxmox.com
Thu Jun 15 12:42:57 CEST 2023


during some tests recently I wondered why a debug log-message was not
printed, despite running with PBS_QEMU_DEBUG.

This patch sets the loglevel for the cli logger to debug if the
variable is present and not-empty (see qemu_helper.rs for the other
usage).

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxmox-file-restore/src/main.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs
index 87caadc4..74ef1979 100644
--- a/proxmox-file-restore/src/main.rs
+++ b/proxmox-file-restore/src/main.rs
@@ -585,7 +585,12 @@ where
 }
 
 fn main() {
-    init_cli_logger("PBS_LOG", "info");
+    let loglevel = match std::env::var("PBS_QEMU_DEBUG") {
+        Ok(val) if !val.is_empty() => "debug",
+        _ => "info"
+    };
+
+    init_cli_logger("PBS_LOG", loglevel);
 
     let list_cmd_def = CliCommand::new(&API_METHOD_LIST)
         .arg_param(&["snapshot", "path"])
-- 
2.30.2






More information about the pve-devel mailing list