public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pdm-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH proxmox 3/6] log: cleanup of logger components
Date: Wed,  7 Oct 2026 09:45:12 +0200	[thread overview]
Message-ID: <20261007074527.102419-4-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20261007074527.102419-1-t.ellmenreich@proxmox.com>

Simplify the logger code. The cleanups performed were:
- Removed some explicit module paths in favour of imports
- Simplified an empty struct by converting it to a unit struct.
- Instead of creating a unit struct as an empty struct, decided
  to instantiate it as a unit struct.

Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
---
 proxmox-log/src/builder.rs            | 9 ++++-----
 proxmox-log/src/pve_task_formatter.rs | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/proxmox-log/src/builder.rs b/proxmox-log/src/builder.rs
index f586b672..aed49f0b 100644
--- a/proxmox-log/src/builder.rs
+++ b/proxmox-log/src/builder.rs
@@ -4,6 +4,7 @@ use tracing::level_filters::LevelFilter;
 use tracing_log::LogTracer;
 use tracing_subscriber::EnvFilter;
 use tracing_subscriber::Layer;
+use tracing_subscriber::Registry;
 use tracing_subscriber::layer::Context;
 use tracing_subscriber::layer::Filter;
 use tracing_subscriber::layer::SubscriberExt;
@@ -56,9 +57,7 @@ impl<S> Filter<S> for NoWorkerTask {
 /// ```
 pub struct Logger {
     global_log_level: EnvFilter,
-    layer: Vec<
-        Box<dyn tracing_subscriber::Layer<tracing_subscriber::Registry> + Send + Sync + 'static>,
-    >,
+    layer: Vec<Box<dyn Layer<Registry> + Send + Sync + 'static>>,
 }
 
 impl Logger {
@@ -97,7 +96,7 @@ impl Logger {
     ///
     /// Check if a LogContext exists and if it does, print to the corresponding task log file.
     pub fn tasklog_pbs(mut self) -> Logger {
-        self.layer.push(TasklogLayer {}.boxed());
+        self.layer.push(TasklogLayer.boxed());
         self
     }
 
@@ -126,7 +125,7 @@ impl Logger {
     /// e.g.: `DEBUG: event message`.
     pub fn stderr_pve(mut self) -> Logger {
         let layer = tracing_subscriber::fmt::layer()
-            .event_format(PveTaskFormatter {})
+            .event_format(PveTaskFormatter)
             .with_writer(std::io::stderr)
             .boxed();
         self.layer.push(layer);
diff --git a/proxmox-log/src/pve_task_formatter.rs b/proxmox-log/src/pve_task_formatter.rs
index e9866a4b..12bc33c8 100644
--- a/proxmox-log/src/pve_task_formatter.rs
+++ b/proxmox-log/src/pve_task_formatter.rs
@@ -8,7 +8,7 @@ use tracing_subscriber::registry::LookupSpan;
 /// This custom formatter outputs logs as they are visible in the PVE task log.
 ///
 /// e.g.: "DEBUG: sample message"
-pub struct PveTaskFormatter {}
+pub struct PveTaskFormatter;
 
 impl<C, N> FormatEvent<C, N> for PveTaskFormatter
 where
-- 
2.47.3





  parent reply	other threads:[~2026-10-07  7:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  7:45 [PATCH datacenter-manager/proxmox 0/6] log: allow finegrained control logging levels Thomas Ellmenreich
2026-10-07  7:45 ` [PATCH proxmox 1/6] log: replace per layer filtering by one global filter Thomas Ellmenreich
2026-10-07  7:45 ` [PATCH proxmox 2/6] fix #6081: log: replace simple level filter with env filter Thomas Ellmenreich
2026-10-07  7:45 ` Thomas Ellmenreich [this message]
2026-10-07  7:45 ` [PATCH proxmox 4/6] log: add tests to the logger Thomas Ellmenreich
2026-10-07  7:45 ` [PATCH datacenter-manager 5/6] api: set REST server debug level based on actual log level Thomas Ellmenreich
2026-10-07  7:45 ` [PATCH datacenter-manager 6/6] api: update logging variable Thomas Ellmenreich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007074527.102419-4-t.ellmenreich@proxmox.com \
    --to=t.ellmenreich@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal