[pbs-devel] [PATCH proxmox-backup 02/10] bins: init cli logger

Hannes Laimer h.laimer at proxmox.com
Fri Mar 11 16:07:47 CET 2022


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 pbs-tape/src/bin/pmt.rs           | 1 +
 pbs-tape/src/bin/pmtx.rs          | 1 +
 proxmox-backup-client/src/main.rs | 1 +
 proxmox-file-restore/src/main.rs  | 4 +++-
 pxar-bin/src/main.rs              | 2 ++
 src/bin/proxmox-backup-debug.rs   | 4 +++-
 src/bin/proxmox-backup-manager.rs | 1 +
 src/bin/proxmox-tape.rs           | 1 +
 src/bin/sg-tape-cmd.rs            | 1 +
 9 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/pbs-tape/src/bin/pmt.rs b/pbs-tape/src/bin/pmt.rs
index 500c63fa..a5b9271d 100644
--- a/pbs-tape/src/bin/pmt.rs
+++ b/pbs-tape/src/bin/pmt.rs
@@ -838,6 +838,7 @@ fn options(
 }
 
 fn main() -> Result<(), Error> {
+    init_cli_logger("PBS_LOG", "info");
 
     let uid = nix::unistd::Uid::current();
 
diff --git a/pbs-tape/src/bin/pmtx.rs b/pbs-tape/src/bin/pmtx.rs
index 23dbc0ae..604d7ce2 100644
--- a/pbs-tape/src/bin/pmtx.rs
+++ b/pbs-tape/src/bin/pmtx.rs
@@ -407,6 +407,7 @@ fn scan(param: Value) -> Result<(), Error> {
 }
 
 fn main() -> Result<(), Error> {
+    init_cli_logger("PBS_LOG", "info");
 
     let uid = nix::unistd::Uid::current();
 
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 7c022fad..744b35e6 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1572,6 +1572,7 @@ impl ReadAt for BufferedDynamicReadAt {
 
 fn main() {
     pbs_tools::setup_libc_malloc_opts();
+    init_cli_logger("PBS_LOG", "info");
 
     let backup_cmd_def = CliCommand::new(&API_METHOD_CREATE_BACKUP)
         .arg_param(&["backupspec"])
diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs
index 0ada15e6..41423c9d 100644
--- a/proxmox-file-restore/src/main.rs
+++ b/proxmox-file-restore/src/main.rs
@@ -10,7 +10,7 @@ use proxmox_sys::fs::{create_path, CreateOptions};
 use proxmox_router::cli::{
     complete_file_name, default_table_format_options,
     format_and_print_result_full, get_output_format,
-    run_cli_command,
+    run_cli_command, init_cli_loggers,
     CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, OUTPUT_FORMAT,
 };
 use proxmox_schema::api;
@@ -452,6 +452,8 @@ where
 }
 
 fn main() {
+    init_cli_logger("PBS_LOG", "info");
+
     let list_cmd_def = CliCommand::new(&API_METHOD_LIST)
         .arg_param(&["snapshot", "path"])
         .completion_cb("repository", complete_repository)
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index 545e6440..495cc119 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -456,6 +456,8 @@ fn dump_archive(archive: String, verbose: bool) -> Result<(), Error> {
 }
 
 fn main() {
+    init_cli_logger("PXAR_LOG", "info");
+
     let cmd_def = CliCommandMap::new()
         .insert(
             "create",
diff --git a/src/bin/proxmox-backup-debug.rs b/src/bin/proxmox-backup-debug.rs
index 33ac4d50..356c8b39 100644
--- a/src/bin/proxmox-backup-debug.rs
+++ b/src/bin/proxmox-backup-debug.rs
@@ -1,5 +1,5 @@
 use proxmox_router::{
-    cli::{run_cli_command, CliCommandMap, CliEnvironment},
+    cli::{init_cli_logger, run_cli_command, CliCommandMap, CliEnvironment},
     RpcEnvironment,
 };
 
@@ -7,6 +7,8 @@ mod proxmox_backup_debug;
 use proxmox_backup_debug::*;
 
 fn main() {
+    init_cli_logger("PBS_LOG", "info");
+
     let cmd_def = CliCommandMap::new()
         .insert("inspect", inspect::inspect_commands())
         .insert("recover", recover::recover_commands())
diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs
index ab2805f3..40e1b2f4 100644
--- a/src/bin/proxmox-backup-manager.rs
+++ b/src/bin/proxmox-backup-manager.rs
@@ -374,6 +374,7 @@ async fn get_versions(verbose: bool, param: Value) -> Result<Value, Error> {
 }
 
 async fn run() -> Result<(), Error> {
+    init_cli_logger("PBS_LOG", "info");
 
     let cmd_def = CliCommandMap::new()
         .insert("acl", acl_commands())
diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
index 1f904452..d0d81fa0 100644
--- a/src/bin/proxmox-tape.rs
+++ b/src/bin/proxmox-tape.rs
@@ -1007,6 +1007,7 @@ async fn catalog_media(mut param: Value)  -> Result<(), Error> {
 }
 
 fn main() {
+    init_cli_logger("PBS_LOG", "info");
 
     let cmd_def = CliCommandMap::new()
         .insert(
diff --git a/src/bin/sg-tape-cmd.rs b/src/bin/sg-tape-cmd.rs
index 7edfe5c5..30d022d7 100644
--- a/src/bin/sg-tape-cmd.rs
+++ b/src/bin/sg-tape-cmd.rs
@@ -131,6 +131,7 @@ fn set_encryption(
 }
 
 fn main() -> Result<(), Error> {
+    init_cli_logger("PBS_LOG", "info");
 
     // check if we are user root or backup
     let backup_uid = pbs_config::backup_user()?.uid;
-- 
2.30.2





More information about the pbs-devel mailing list