From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] fix #4578: use log crate for pxar create logging
Date: Wed, 8 Mar 2023 11:57:47 +0100 [thread overview]
Message-ID: <20230308105748.296776-1-f.gruenbichler@proxmox.com> (raw)
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
next reply other threads:[~2023-03-08 10:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 10:57 Fabian Grünbichler [this message]
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
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=20230308105748.296776-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox