From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 1EB6D1FF0B7 for ; Fri, 02 Oct 2026 10:10:21 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E27632166A; Fri, 02 Oct 2026 10:10:20 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Fri, 02 Oct 2026 10:10:16 +0200 Message-Id: Subject: Re: [PATCH proxmox v2 3/4] log: add tests to the logger From: "Lukas Wagner" To: "Thomas Ellmenreich" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260923115815.211083-1-t.ellmenreich@proxmox.com> <20260923115815.211083-4-t.ellmenreich@proxmox.com> In-Reply-To: <20260923115815.211083-4-t.ellmenreich@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790928616448 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.395 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: P2F2UNMMB2JY3OJL3VKB7XB2WKEUXAPL X-Message-ID-Hash: P2F2UNMMB2JY3OJL3VKB7XB2WKEUXAPL X-MailFrom: l.wagner@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 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: On Wed Sep 23, 2026 at 1:58 PM CEST, Thomas Ellmenreich wrote: > Add tests to ensure consistent functionality when setting the logging > environment variable, as well as global filtering of logs. > > Although the EnvFilter itself is not something we should be testing, we a= re > adding some additional machinery, on top of the extensive functionality > provided by tracing/tracing_subscriber, which does need testing. > [...] > /// If present, tries to parse the `env_filter_str` as a [`EnvFilter= `], > /// otherwiese falls back to the provided default log level. > /// > @@ -170,3 +178,281 @@ impl Logger { > } > } Thanks a lot for writing tests for this! For completeness, you might also change some of the tests (or add 1-2 new ones) to emit native tracing events (e.g. tracing::info!), right now you only emit log events (either directly through the `log` crate or through `tracing_log::log`). The risk that one works and the other does not is minimal, but while at it it certainly does not hurt. Also please check `cargo clippy --tests`, there are some minor warnings here (also about overindented documentation). > =20 > +#[cfg(test)] > +mod tests { > + use std::sync::{Arc, Mutex}; > + > + use tracing::level_filters::LevelFilter; > + use tracing_log::log; > + use tracing_subscriber::{Layer, util::SubscriberInitExt};