From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager v2] api: priv-api: admin-cli: use new logger builder
Date: Fri, 11 Apr 2025 14:10:28 +0200 [thread overview]
Message-ID: <20250411121028.265555-1-l.wagner@proxmox.com> (raw)
The Logger::tasklog_pbs is actually not specific to PBS but should be
used for anything that uses WorkerTasks with a LogContext.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
---
Notes:
We might want to rename Logger::tasklog_pbs at some point.
cli/admin/src/main.rs | 5 ++++-
server/src/bin/proxmox-datacenter-api/main.rs | 6 +++++-
server/src/bin/proxmox-datacenter-privileged-api.rs | 5 ++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cli/admin/src/main.rs b/cli/admin/src/main.rs
index 5fa9116b..91b93f3c 100644
--- a/cli/admin/src/main.rs
+++ b/cli/admin/src/main.rs
@@ -4,7 +4,10 @@ mod remotes;
fn main() {
//pbs_tools::setup_libc_malloc_opts(); // TODO: move from PBS to proxmox-sys and uncomment
- proxmox_log::init_cli_logger("PDM_LOG", proxmox_log::LevelFilter::INFO)
+
+ proxmox_log::Logger::from_env("PDM_LOG", proxmox_log::LevelFilter::INFO)
+ .stderr()
+ .init()
.expect("failed to set up logger");
server::context::init().expect("could not set up server context");
diff --git a/server/src/bin/proxmox-datacenter-api/main.rs b/server/src/bin/proxmox-datacenter-api/main.rs
index 25852c8c..771fe45f 100644
--- a/server/src/bin/proxmox-datacenter-api/main.rs
+++ b/server/src/bin/proxmox-datacenter-api/main.rs
@@ -46,7 +46,11 @@ fn main() -> Result<(), Error> {
server::env::sanitize_environment_vars();
let debug = std::env::var("PROXMOX_DEBUG").is_ok();
- proxmox_log::init_logger("PROXMOX_DEBUG", LevelFilter::INFO)?;
+
+ proxmox_log::Logger::from_env("PROXMOX_DEBUG", LevelFilter::INFO)
+ .journald_on_no_workertask()
+ .tasklog_pbs()
+ .init()?;
if std::env::args().nth(1).is_some() {
bail!("unexpected command line parameters");
diff --git a/server/src/bin/proxmox-datacenter-privileged-api.rs b/server/src/bin/proxmox-datacenter-privileged-api.rs
index 0e23a5f1..1f8a947c 100644
--- a/server/src/bin/proxmox-datacenter-privileged-api.rs
+++ b/server/src/bin/proxmox-datacenter-privileged-api.rs
@@ -23,7 +23,10 @@ fn main() -> Result<(), Error> {
server::env::sanitize_environment_vars();
- proxmox_log::init_logger("PROXMOX_DEBUG", LevelFilter::INFO)?;
+ proxmox_log::Logger::from_env("PROXMOX_DEBUG", LevelFilter::INFO)
+ .journald_on_no_workertask()
+ .tasklog_pbs()
+ .init()?;
create_directories()?;
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next reply other threads:[~2025-04-11 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 12:10 Lukas Wagner [this message]
2025-04-14 14:46 ` [pdm-devel] applied: " 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=20250411121028.265555-1-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal