all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 04/10] pbs-datastore: replace print with log macro
Date: Fri, 11 Mar 2022 15:07:49 +0000	[thread overview]
Message-ID: <20220311150755.73338-5-h.laimer@proxmox.com> (raw)
In-Reply-To: <20220311150755.73338-1-h.laimer@proxmox.com>

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 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 22454921..239e4428 100644
--- a/pbs-datastore/src/catalog.rs
+++ b/pbs-datastore/src/catalog.rs
@@ -562,7 +562,7 @@ impl <R: Read + Seek> CatalogReader<R> {
 
             match etype {
                 CatalogEntryType::Directory => {
-                    println!("{} {:?}", etype, path);
+                    log::info!("{} {:?}", etype, path);
                     if offset > start {
                         bail!("got wrong directory offset ({} > {})", offset, start);
                     }
@@ -575,7 +575,7 @@ impl <R: Read + Seek> CatalogReader<R> {
                         mtime_string = s;
                     }
 
-                    println!(
+                    log::info!(
                         "{} {:?} {} {}",
                         etype,
                         path,
@@ -584,7 +584,7 @@ impl <R: Read + Seek> CatalogReader<R> {
                     );
                 }
                 _ => {
-                    println!("{} {:?}", etype, path);
+                    log::info!("{} {:?}", etype, path);
                 }
             }
 
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index d416c8d8..38b3faab 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -122,7 +122,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()
                 }
             }
@@ -263,7 +263,7 @@ impl DataStore {
             if let Ok(name) = std::str::from_utf8(file_name) {
                 if wanted_files.contains(name) { 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 7a1a39d3..6f949eb6 100644
--- a/pbs-datastore/src/dynamic_index.rs
+++ b/pbs-datastore/src/dynamic_index.rs
@@ -461,7 +461,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 21404eed..4d702769 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<W: Write>(
                 (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





  parent reply	other threads:[~2022-03-11 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 15:07 [pbs-devel] [PATCH-SERIES] replace print by log macro in libraries Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox 1/10] router: add init_cli_logger helper function Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 02/10] bins: init cli logger Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 03/10] pbs-client: replace print with log macro Hannes Laimer
2022-03-11 15:07 ` Hannes Laimer [this message]
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 05/10] pbs-fuse+pbs-tape: " Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 06/10] proxmox-backup-client: " Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 07/10] proxmox-file-restore: " Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 08/10] proxmox-rest-server: " Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 09/10] " Hannes Laimer
2022-03-11 15:07 ` [pbs-devel] [PATCH proxmox-backup 10/10] docs: add note for setting verbosity level Hannes Laimer
2022-03-17  8:40 ` [pbs-devel] [PATCH-SERIES] replace print by log macro in libraries Wolfgang Bumiller
2022-03-18  6:02   ` Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220311150755.73338-5-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal