From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 421927100C for ; Tue, 10 May 2022 11:02:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0C94854F1 for ; Tue, 10 May 2022 11:02:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E5DA85460 for ; Tue, 10 May 2022 11:02:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B93E943298 for ; Tue, 10 May 2022 11:02:16 +0200 (CEST) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Tue, 10 May 2022 09:01:49 +0000 Message-Id: <20220510090158.33504-2-h.laimer@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220510090158.33504-1-h.laimer@proxmox.com> References: <20220510090158.33504-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [pmtx.rs, proxmox-tape.rs, proxmox-backup-manager.rs, pmt.rs, main.rs, proxmox-backup-debug.rs, sg-tape-cmd.rs] Subject: [pbs-devel] [PATCH proxmox-backup rebased 1/9] bins: init cli logger X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 09:02:51 -0000 Signed-off-by: Hannes Laimer --- pbs-tape/src/bin/pmt.rs | 2 ++ pbs-tape/src/bin/pmtx.rs | 2 ++ proxmox-backup-client/src/main.rs | 1 + proxmox-file-restore/src/main.rs | 6 ++++-- pxar-bin/src/main.rs | 2 ++ src/bin/proxmox-backup-debug.rs | 4 +++- src/bin/proxmox-backup-manager.rs | 2 ++ src/bin/proxmox-tape.rs | 2 ++ src/bin/sg-tape-cmd.rs | 2 ++ 9 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pbs-tape/src/bin/pmt.rs b/pbs-tape/src/bin/pmt.rs index 5f4f6074..75e8e93a 100644 --- a/pbs-tape/src/bin/pmt.rs +++ b/pbs-tape/src/bin/pmt.rs @@ -801,6 +801,8 @@ fn options( } fn main() -> Result<(), Error> { + init_cli_logger("PBS_LOG", "info"); + let uid = nix::unistd::Uid::current(); let username = match nix::unistd::User::from_uid(uid)? { diff --git a/pbs-tape/src/bin/pmtx.rs b/pbs-tape/src/bin/pmtx.rs index cea62c74..1d58d737 100644 --- a/pbs-tape/src/bin/pmtx.rs +++ b/pbs-tape/src/bin/pmtx.rs @@ -387,6 +387,8 @@ fn scan(param: Value) -> Result<(), Error> { } fn main() -> Result<(), Error> { + init_cli_logger("PBS_LOG", "info"); + let uid = nix::unistd::Uid::current(); let username = match nix::unistd::User::from_uid(uid)? { diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index d7066b36..c095082e 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -1561,6 +1561,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 6b5e65b9..c1814897 100644 --- a/proxmox-file-restore/src/main.rs +++ b/proxmox-file-restore/src/main.rs @@ -8,8 +8,8 @@ use serde_json::{json, Value}; use proxmox_router::cli::{ complete_file_name, default_table_format_options, format_and_print_result_full, - get_output_format, run_cli_command, CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, - OUTPUT_FORMAT, + get_output_format, init_cli_logger, run_cli_command, CliCommand, CliCommandMap, CliEnvironment, + ColumnConfig, OUTPUT_FORMAT, }; use proxmox_router::{http_err, HttpError}; use proxmox_schema::api; @@ -517,6 +517,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 6a13f38a..bad68f24 100644 --- a/pxar-bin/src/main.rs +++ b/pxar-bin/src/main.rs @@ -442,6 +442,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 e467c956..c8ea0539 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 abb7954a..3391a5b6 100644 --- a/src/bin/proxmox-backup-manager.rs +++ b/src/bin/proxmox-backup-manager.rs @@ -378,6 +378,8 @@ async fn get_versions(verbose: bool, param: Value) -> Result { } async fn run() -> Result<(), Error> { + init_cli_logger("PBS_LOG", "info"); + let cmd_def = CliCommandMap::new() .insert("acl", acl_commands()) .insert("datastore", datastore_commands()) diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs index 6fa7c0f2..089013bd 100644 --- a/src/bin/proxmox-tape.rs +++ b/src/bin/proxmox-tape.rs @@ -972,6 +972,8 @@ async fn catalog_media(mut param: Value) -> Result<(), Error> { } fn main() { + init_cli_logger("PBS_LOG", "info"); + let cmd_def = CliCommandMap::new() .insert( "backup", diff --git a/src/bin/sg-tape-cmd.rs b/src/bin/sg-tape-cmd.rs index fe301ba2..402fe9cb 100644 --- a/src/bin/sg-tape-cmd.rs +++ b/src/bin/sg-tape-cmd.rs @@ -123,6 +123,8 @@ 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; let backup_gid = pbs_config::backup_group()?.gid; -- 2.30.2