[pbs-devel] [PATCH] log: only print error level to syslog/stderr

Gabriel Goller g.goller at proxmox.com
Fri Oct 18 13:11:46 CEST 2024


We only want to print the error level, and not all the levels below
error to stderr/syslog.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---

Note: the sign was reversed "<=" would have been correct, because we
want to print everything that's *less* verbose than Level::ERROR, but
there is nothing lower than ERROR, so == is better.

 proxmox-log/src/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs
index 332f66221477..8c74e42b618d 100644
--- a/proxmox-log/src/lib.rs
+++ b/proxmox-log/src/lib.rs
@@ -57,7 +57,7 @@ pub fn init_logger(
         .with(
             journald_or_stderr_layer()
                 .with_filter(filter_fn(|metadata| {
-                    !LogContext::exists() || *metadata.level() >= Level::ERROR
+                    !LogContext::exists() || *metadata.level() == Level::ERROR
                 }))
                 .with_filter(log_level),
         )
-- 
2.39.5





More information about the pbs-devel mailing list