[pbs-devel] [PATCH proxmox-backup 1/2] use PROXMOX_DEBUG env variable to control loglevel

Dominik Csapak d.csapak at proxmox.com
Fri Feb 4 10:12:20 CET 2022


so that we can use 'log::debug' to actually log debug messages

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
without this or something similar, we cannot actually see the messages
from 'log::debug' (and we're using that sometimes)

 src/bin/proxmox-backup-proxy.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 9bacac97..73844935 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -188,18 +188,18 @@ async fn get_index_future(env: RestEnvironment, parts: Parts) -> Response<Body>
 }
 
 async fn run() -> Result<(), Error> {
+    // Note: To debug early connection error use
+    // PROXMOX_DEBUG=1 ./target/release/proxmox-backup-proxy
+    let debug = std::env::var("PROXMOX_DEBUG").is_ok();
+
     if let Err(err) = syslog::init(
         syslog::Facility::LOG_DAEMON,
-        log::LevelFilter::Info,
+        if debug { log::LevelFilter::Debug } else { log::LevelFilter::Info },
         Some("proxmox-backup-proxy"),
     ) {
         bail!("unable to inititialize syslog - {}", err);
     }
 
-    // Note: To debug early connection error use
-    // PROXMOX_DEBUG=1 ./target/release/proxmox-backup-proxy
-    let debug = std::env::var("PROXMOX_DEBUG").is_ok();
-
     let _ = public_auth_key(); // load with lazy_static
     let _ = csrf_secret(); // load with lazy_static
 
-- 
2.30.2






More information about the pbs-devel mailing list