From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E16CC1FF0AB for ; Wed, 07 Oct 2026 09:45:41 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4739121218; Wed, 07 Oct 2026 09:45:41 +0200 (CEST) From: Thomas Ellmenreich To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox 3/6] log: cleanup of logger components Date: Wed, 7 Oct 2026 09:45:12 +0200 Message-ID: <20261007074527.102419-4-t.ellmenreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261007074527.102419-1-t.ellmenreich@proxmox.com> References: <20261007074527.102419-1-t.ellmenreich@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791359136507 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.477 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VW2CCDKZXRF5KBAFAVIZGUTCMNNZNOOW X-Message-ID-Hash: VW2CCDKZXRF5KBAFAVIZGUTCMNNZNOOW X-MailFrom: t.ellmenreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Thomas Ellmenreich X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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 Filter for NoWorkerTask { /// ``` pub struct Logger { global_log_level: EnvFilter, - layer: Vec< - Box + Send + Sync + 'static>, - >, + layer: Vec + 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 FormatEvent for PveTaskFormatter where -- 2.47.3