all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox] log: write to stderr when using init_cli_logger, export tracing::Level
@ 2024-09-03 12:38 Gabriel Goller
  2024-09-03 12:38 ` [pbs-devel] [PATCH proxmox-backup] pxar-bin: remove `log` dependency, use `tracing` directly Gabriel Goller
  0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Goller @ 2024-09-03 12:38 UTC (permalink / raw)
  To: 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 <g.goller@proxmox.com>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-04 13:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-03 12:38 [pbs-devel] [PATCH proxmox] log: write to stderr when using init_cli_logger, export tracing::Level Gabriel Goller
2024-09-03 12:38 ` [pbs-devel] [PATCH proxmox-backup] pxar-bin: remove `log` dependency, use `tracing` directly Gabriel Goller
2024-09-04  8:06   ` Christian Ebner
2024-09-04 12:31     ` Christian Ebner
2024-09-04 13:27     ` Gabriel Goller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal