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 CDF44693EB for ; Fri, 11 Mar 2022 16:08:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BB98726712 for ; Fri, 11 Mar 2022 16:08:06 +0100 (CET) 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 34023266D9 for ; Fri, 11 Mar 2022 16:08:04 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0B075439DD for ; Fri, 11 Mar 2022 16:08:04 +0100 (CET) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Fri, 11 Mar 2022 15:07:53 +0000 Message-Id: <20220311150755.73338-9-h.laimer@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220311150755.73338-1-h.laimer@proxmox.com> References: <20220311150755.73338-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.041 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 - Subject: [pbs-devel] [PATCH proxmox-backup 08/10] proxmox-rest-server: replace print with log macro 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: Fri, 11 Mar 2022 15:08:36 -0000 Signed-off-by: Hannes Laimer --- proxmox-rest-server/src/api_config.rs | 4 ++-- proxmox-rest-server/src/command_socket.rs | 10 +++++----- proxmox-rest-server/src/file_logger.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/proxmox-rest-server/src/api_config.rs b/proxmox-rest-server/src/api_config.rs index ad76a15f..2a6e1a91 100644 --- a/proxmox-rest-server/src/api_config.rs +++ b/proxmox-rest-server/src/api_config.rs @@ -213,7 +213,7 @@ impl ApiConfig { self.request_log = Some(Arc::clone(&request_log)); commando_sock.register_command("api-access-log-reopen".into(), move |_args| { - println!("re-opening access-log file"); + log::info!("re-opening access-log file"); request_log.lock().unwrap().reopen()?; Ok(serde_json::Value::Null) })?; @@ -253,7 +253,7 @@ impl ApiConfig { self.auth_log = Some(Arc::clone(&auth_log)); commando_sock.register_command("api-auth-log-reopen".into(), move |_args| { - println!("re-opening auth-log file"); + log::info!("re-opening auth-log file"); auth_log.lock().unwrap().reopen()?; Ok(serde_json::Value::Null) })?; diff --git a/proxmox-rest-server/src/command_socket.rs b/proxmox-rest-server/src/command_socket.rs index 46814c4f..be4a72a1 100644 --- a/proxmox-rest-server/src/command_socket.rs +++ b/proxmox-rest-server/src/command_socket.rs @@ -31,7 +31,7 @@ where let (conn, _addr) = match socket.accept().await { Ok(data) => data, Err(err) => { - eprintln!("failed to accept on control socket {:?}: {}", path, err); + log::error!("failed to accept on control socket {:?}: {}", path, err); continue; } }; @@ -40,7 +40,7 @@ where let cred = match socket::getsockopt(conn.as_raw_fd(), opt) { Ok(cred) => cred, Err(err) => { - eprintln!("no permissions - unable to read peer credential - {}", err); + log::error!("no permissions - unable to read peer credential - {}", err); continue; } }; @@ -48,7 +48,7 @@ where // check permissions (same gid, root user, or backup group) let mygid = unsafe { libc::getgid() }; if !(cred.uid() == 0 || cred.gid() == mygid || cred.gid() == gid) { - eprintln!("no permissions for {:?}", cred); + log::error!("no permissions for {:?}", cred); continue; } @@ -69,7 +69,7 @@ where Ok(0) => break, Ok(_) => (), Err(err) => { - eprintln!("control socket {:?} read error: {}", path, err); + log::error!("control socket {:?} read error: {}", path, err); return; } } @@ -83,7 +83,7 @@ where }; if let Err(err) = tx.write_all(response.as_bytes()).await { - eprintln!("control socket {:?} write response error: {}", path, err); + log::error!("control socket {:?} write response error: {}", path, err); return; } } diff --git a/proxmox-rest-server/src/file_logger.rs b/proxmox-rest-server/src/file_logger.rs index 7d4d3f86..6aec3422 100644 --- a/proxmox-rest-server/src/file_logger.rs +++ b/proxmox-rest-server/src/file_logger.rs @@ -122,7 +122,7 @@ impl FileLogger { if let Err(err) = self.file.write_all(line.as_bytes()) { // avoid panicking, log methods should not do that // FIXME: or, return result??? - eprintln!("error writing to log file - {}", err); + log::error!("error writing to log file - {}", err); } } } -- 2.30.2