public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] fix #4578: use log crate for pxar create logging
@ 2023-03-08 10:57 Fabian Grünbichler
  2023-03-08 10:57 ` [pbs-devel] [PATCH proxmox-backup 2/2] pxar creation: use log crate for error reporting Fabian Grünbichler
  2023-03-27  9:35 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/2] fix #4578: use log crate for pxar create logging Wolfgang Bumiller
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2023-03-08 10:57 UTC (permalink / raw)
  To: pbs-devel

since proxmox-backup-client is used in cron jobs and similar automated
fashions, PBS_LOG= should control the output..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
came up a few times in the forum already, follow up to the switch to log

 pbs-client/src/pxar/create.rs | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 1bce3a41..4bc22bf4 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -113,20 +113,6 @@ struct HardLinkInfo {
     st_ino: u64,
 }
 
-/// TODO: make a builder for the create_archive call for fewer parameters and add a method to add a
-/// logger which does not write to stderr.
-struct Logger;
-
-impl std::io::Write for Logger {
-    fn write(&mut self, data: &[u8]) -> io::Result<usize> {
-        std::io::stderr().write(data)
-    }
-
-    fn flush(&mut self) -> io::Result<()> {
-        std::io::stderr().flush()
-    }
-}
-
 /// And the error case.
 struct ErrorReporter;
 
@@ -155,7 +141,6 @@ struct Archiver {
     device_set: Option<HashSet<u64>>,
     hardlinks: HashMap<HardLinkInfo, (PathBuf, LinkOffset)>,
     errors: ErrorReporter,
-    logger: Logger,
     file_copy_buffer: Vec<u8>,
 }
 
@@ -221,7 +206,6 @@ where
         device_set,
         hardlinks: HashMap::new(),
         errors: ErrorReporter,
-        logger: Logger,
         file_copy_buffer: vec::undefined(4 * 1024 * 1024),
     };
 
@@ -706,7 +690,7 @@ impl Archiver {
         }
 
         let result = if skip_contents {
-            writeln!(self.logger, "skipping mount point: {:?}", self.path)?;
+            log::info!("skipping mount point: {:?}", self.path);
             Ok(())
         } else {
             self.archive_dir_contents(&mut encoder, dir, false).await
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-27  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 10:57 [pbs-devel] [PATCH proxmox-backup 1/2] fix #4578: use log crate for pxar create logging Fabian Grünbichler
2023-03-08 10:57 ` [pbs-devel] [PATCH proxmox-backup 2/2] pxar creation: use log crate for error reporting Fabian Grünbichler
2023-03-27  9:35 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/2] fix #4578: use log crate for pxar create logging Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal