From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id DA00D1FF15C for ; Wed, 4 Sep 2024 15:28:59 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2AE041C9BD; Wed, 4 Sep 2024 15:29:34 +0200 (CEST) From: Gabriel Goller To: pbs-devel@lists.proxmox.com Date: Wed, 4 Sep 2024 15:28:56 +0200 Message-Id: <20240904132857.370518-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.040 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lib.rs] Subject: [pbs-devel] [PATCH v2] 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. Tested-by: Christian Ebner Reviewed-by: Christian Ebner Signed-off-by: Gabriel Goller --- v2: nothing changed 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