From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 86A0A1FF16C for ; Tue, 3 Sep 2024 14:37:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1526B9A85; Tue, 3 Sep 2024 14:38:16 +0200 (CEST) From: Gabriel Goller To: pbs-devel@lists.proxmox.com Date: Tue, 3 Sep 2024 14:38:10 +0200 Message-Id: <20240903123811.362524-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.041 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox] log: write to stderr when using init_cli_logger, export tracing::Level X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Previously when using `env_logger` all of our cli-tools logged to stderr, make tracing do the same. Export `tracing::Level` so that we can use the `tracing::enabled!` macro. Signed-off-by: Gabriel Goller --- proxmox-log/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs index bcde5495dead..0cf5cb7a50b2 100644 --- a/proxmox-log/src/lib.rs +++ b/proxmox-log/src/lib.rs @@ -6,7 +6,6 @@ use std::future::Future; use std::sync::{Arc, Mutex}; use tokio::task::futures::TaskLocalFuture; -use tracing::Level; use tracing_log::{AsLog, LogTracer}; use tracing_subscriber::filter::filter_fn; use tracing_subscriber::prelude::*; @@ -32,6 +31,7 @@ pub use tracing::trace; pub use tracing::trace_span; pub use tracing::warn; pub use tracing::warn_span; +pub use tracing::Level; pub use tracing_subscriber::filter::LevelFilter; tokio::task_local! { @@ -154,6 +154,7 @@ pub fn init_cli_logger( .with( tracing_subscriber::fmt::layer() .event_format(format) + .with_writer(std::io::stderr) .with_filter(filter_fn(|metadata| { !LogContext::exists() || *metadata.level() >= Level::ERROR })) -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel