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 DF03370FA3 for ; Tue, 10 May 2022 11:02:50 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CE90D54F0 for ; Tue, 10 May 2022 11:02:20 +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 1F1465469 for ; Tue, 10 May 2022 11:02:17 +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 E9336432C8 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:52 +0000 Message-Id: <20220510090158.33504-5-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. [datastore.rs, catalog.rs, paperkey.rs] Subject: [pbs-devel] [PATCH proxmox-backup rebased 3/9] pbs-datastore: 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: Tue, 10 May 2022 09:02:50 -0000 Signed-off-by: Hannes Laimer --- pbs-datastore/src/catalog.rs | 6 +++--- pbs-datastore/src/datastore.rs | 4 ++-- pbs-datastore/src/dynamic_index.rs | 2 +- pbs-datastore/src/fixed_index.rs | 14 +++++++------- pbs-datastore/src/paperkey.rs | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pbs-datastore/src/catalog.rs b/pbs-datastore/src/catalog.rs index c07b71a6..f1224041 100644 --- a/pbs-datastore/src/catalog.rs +++ b/pbs-datastore/src/catalog.rs @@ -636,7 +636,7 @@ impl CatalogReader { match etype { CatalogEntryType::Directory => { - println!("{} {:?}", etype, path); + log::info!("{} {:?}", etype, path); if offset > start { bail!("got wrong directory offset ({} > {})", offset, start); } @@ -649,10 +649,10 @@ impl CatalogReader { mtime_string = s; } - println!("{} {:?} {} {}", etype, path, size, mtime_string,); + log::info!("{} {:?} {} {}", etype, path, size, mtime_string,); } _ => { - println!("{} {:?}", etype, path); + log::info!("{} {:?}", etype, path); } } diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 6df23c52..af8331e3 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -220,7 +220,7 @@ impl DataStore { match serde_json::from_str(&state) { Ok(state) => state, Err(err) => { - eprintln!("error reading gc-status: {}", err); + log::error!("error reading gc-status: {}", err); GarbageCollectionStatus::default() } } @@ -389,7 +389,7 @@ impl DataStore { continue; } } - println!("remove unused file {:?}", item.file_name()); + log::info!("remove unused file {:?}", item.file_name()); let dirfd = item.parent_fd(); let _res = unsafe { libc::unlinkat(dirfd, item.file_name().as_ptr(), 0) }; } diff --git a/pbs-datastore/src/dynamic_index.rs b/pbs-datastore/src/dynamic_index.rs index 9eb035d1..306717ac 100644 --- a/pbs-datastore/src/dynamic_index.rs +++ b/pbs-datastore/src/dynamic_index.rs @@ -465,7 +465,7 @@ impl DynamicChunkWriter { self.stat.disk_size += compressed_size; } - println!( + log::info!( "ADD CHUNK {:016x} {} {}% {} {}", self.chunk_offset, chunk_size, diff --git a/pbs-datastore/src/fixed_index.rs b/pbs-datastore/src/fixed_index.rs index 5fc3d2ab..936bd2e7 100644 --- a/pbs-datastore/src/fixed_index.rs +++ b/pbs-datastore/src/fixed_index.rs @@ -51,7 +51,7 @@ unsafe impl Sync for FixedIndexReader {} impl Drop for FixedIndexReader { fn drop(&mut self) { if let Err(err) = self.unmap() { - eprintln!("Unable to unmap file - {}", err); + log::error!("Unable to unmap file - {}", err); } } } @@ -144,16 +144,16 @@ impl FixedIndexReader { } pub fn print_info(&self) { - println!("Size: {}", self.size); - println!("ChunkSize: {}", self.chunk_size); + log::info!("Size: {}", self.size); + log::info!("ChunkSize: {}", self.chunk_size); let mut ctime_str = self.ctime.to_string(); if let Ok(s) = proxmox_time::strftime_local("%c", self.ctime) { ctime_str = s; } - println!("CTime: {}", ctime_str); - println!("UUID: {:?}", self.uuid); + log::info!("CTime: {}", ctime_str); + log::info!("UUID: {:?}", self.uuid); } } @@ -247,7 +247,7 @@ impl Drop for FixedIndexWriter { fn drop(&mut self) { let _ = std::fs::remove_file(&self.tmp_filename); // ignore errors if let Err(err) = self.unmap() { - eprintln!("Unable to unmap file {:?} - {}", self.tmp_filename, err); + log::error!("Unable to unmap file {:?} - {}", self.tmp_filename, err); } } } @@ -418,7 +418,7 @@ impl FixedIndexWriter { let digest = &chunk_info.digest; - println!( + log::info!( "ADD CHUNK {} {} {}% {} {}", idx, chunk_len, diff --git a/pbs-datastore/src/paperkey.rs b/pbs-datastore/src/paperkey.rs index 8caca0b9..27ef1028 100644 --- a/pbs-datastore/src/paperkey.rs +++ b/pbs-datastore/src/paperkey.rs @@ -63,7 +63,7 @@ pub fn generate_paper_key( (lines, false) } Err(err) => { - eprintln!("Couldn't parse data as KeyConfig - {}", err); + log::error!("Couldn't parse data as KeyConfig - {}", err); bail!("Neither a PEM-formatted private key, nor a PBS key file."); } } -- 2.30.2