From: Gabriel Goller <g.goller@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2] log: write to stderr when using init_cli_logger, export tracing::Level
Date: Wed, 4 Sep 2024 15:28:56 +0200 [thread overview]
Message-ID: <20240904132857.370518-1-g.goller@proxmox.com> (raw)
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 <c.ebner@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
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
next reply other threads:[~2024-09-04 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 13:28 Gabriel Goller [this message]
2024-09-04 13:28 ` [pbs-devel] [PATCH proxmox-backup v2] pxar-bin: remove `log` dependency, use `tracing` directly Gabriel Goller
2024-09-05 12:02 ` [pbs-devel] applied-series: [PATCH v2] log: write to stderr when using init_cli_logger, export tracing::Level Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240904132857.370518-1-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox