[pbs-devel] [PATCH] log: reorder filters

Gabriel Goller g.goller at proxmox.com
Mon Jul 15 17:13:14 CEST 2024


Reorder the filters for the journald layer. This sets the LevelFilter
last, which means tracing can disable all log statements lower than the
current level without evaluating the LogContext::exists function.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 proxmox-log/src/lib.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs
index f4f24e0c43ab..990065150483 100644
--- a/proxmox-log/src/lib.rs
+++ b/proxmox-log/src/lib.rs
@@ -52,10 +52,10 @@ pub fn init_logger(
         .with(
             tracing_journald::layer()
                 .expect("Unable to open syslog")
-                .with_filter(log_level)
                 .with_filter(filter_fn(|metadata| {
                     LogContext::exists() || *metadata.level() == Level::ERROR
-                })),
+                }))
+                .with_filter(log_level),
         )
         .with(TasklogLayer {}.with_filter(log_level));
 
-- 
2.43.0





More information about the pbs-devel mailing list