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 43E911FF0AF for ; Fri, 23 Oct 2026 13:31:27 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 00FCF2162C; Fri, 23 Oct 2026 13:31:27 +0200 (CEST) From: Thomas Ellmenreich To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox v2 4/7] log: clean up of logger components Date: Fri, 23 Oct 2026 13:31:15 +0200 Message-ID: <20261023113120.332453-5-t.ellmenreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261023113120.332453-1-t.ellmenreich@proxmox.com> References: <20261023113120.332453-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: 1792755082563 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.402 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: F6TI22LK4RBCO5NZ3SHXDMDGGDUYCG2H X-Message-ID-Hash: F6TI22LK4RBCO5NZ3SHXDMDGGDUYCG2H 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: - Remove some explicit module paths in favor of imports - Simplify an empty struct by converting it to a unit struct. - Instead of creating a unit struct as an empty struct, instantiated 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 fb8e7d70..e52379d0 100644 --- a/proxmox-log/src/builder.rs +++ b/proxmox-log/src/builder.rs @@ -6,6 +6,7 @@ use tracing_log::AsLog; 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; @@ -58,9 +59,7 @@ impl Filter for NoWorkerTask { /// ``` pub struct Logger { global_log_filter: EnvFilter, - layer: Vec< - Box + Send + Sync + 'static>, - >, + layer: Vec + Send + Sync + 'static>>, } impl Logger { @@ -99,7 +98,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 } @@ -128,7 +127,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