From 39531dfc8088857123a27795b43eca83634aa1b1 Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Thu, 15 Jun 2023 12:42:57 +0200 Subject: [PATCH] file-restore: set loglevel considering PBS_QEMU_DEBUG 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 --- 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"])