* [pdm-devel] [PATCH proxmox-datacenter-manager] api: priv-api: admin-cli: use new logger builder
@ 2025-04-11 11:32 Lukas Wagner
2025-04-11 11:39 ` Gabriel Goller
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Wagner @ 2025-04-11 11:32 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
Notes:
The Logger::tasklog_pbs is actually not specific to PBS but should be
used for anything that uses WorkerTasks with a LogContext, as far as I
can tell. We might want to rename it 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-11 12:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-11 11:32 [pdm-devel] [PATCH proxmox-datacenter-manager] api: priv-api: admin-cli: use new logger builder Lukas Wagner
2025-04-11 11:39 ` Gabriel Goller
2025-04-11 12:12 ` [pdm-devel] superseded: " Lukas Wagner
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