reader: &mut R,
target: &str,
feature_flags: Flags,
- verbose: bool,
options: PxarExtractOptions,
) -> Result<(), Error> {
pbs_client::pxar::extract_archive(
Path::new(target),
feature_flags,
|path| {
- if verbose {
- println!("{:?}", path);
- }
+ log::debug!("{:?}", path);
},
options,
)
description: "Target directory",
optional: true,
},
- verbose: {
- description: "Verbose output.",
- optional: true,
- default: false,
- },
"no-xattrs": {
description: "Ignore extended file attributes.",
optional: true,
archive: String,
pattern: Option<Vec<String>>,
target: Option<String>,
- verbose: bool,
no_xattrs: bool,
no_fcaps: bool,
no_acls: bool,
// otherwise we want to log them but not act on them
Some(Box::new(move |err| {
was_ok.store(false, Ordering::Release);
- eprintln!("error: {}", err);
+ log::error!("error: {}", err);
Ok(())
})
as Box<dyn FnMut(Error) -> Result<(), Error> + Send>)
if archive == "-" {
let stdin = std::io::stdin();
let mut reader = stdin.lock();
- extract_archive_from_reader(&mut reader, target, feature_flags, verbose, options)?;
+ extract_archive_from_reader(&mut reader, target, feature_flags, options)?;
} else {
- if verbose {
- println!("PXAR extract: {}", archive);
- }
+ log::debug!("PXAR extract: {}", archive);
let file = std::fs::File::open(archive)?;
let mut reader = std::io::BufReader::new(file);
- extract_archive_from_reader(&mut reader, target, feature_flags, verbose, options)?;
+ extract_archive_from_reader(&mut reader, target, feature_flags, options)?;
}
if !was_ok.load(Ordering::Acquire) {
source: {
description: "Source directory.",
},
- verbose: {
- description: "Verbose output.",
- optional: true,
- default: false,
- },
"no-xattrs": {
description: "Ignore extended file attributes.",
optional: true,
async fn create_archive(
archive: String,
source: String,
- verbose: bool,
no_xattrs: bool,
no_fcaps: bool,
no_acls: bool,
entries_max: entries_max as usize,
device_set,
patterns,
- verbose,
skip_lost_and_found: false,
};
writer,
feature_flags,
move |path| {
- if verbose {
- println!("{:?}", path);
- }
+ log::debug!("{:?}", path);
Ok(())
},
None,
select! {
res = session.fuse() => res?,
_ = interrupt.recv().fuse() => {
- if verbose {
- eprintln!("interrupted");
- }
+ log::debug!("interrupted");
}
}
archive: {
description: "Archive name.",
},
- verbose: {
- description: "Verbose output.",
- optional: true,
- default: false,
- },
},
},
)]
/// List the contents of an archive.
-fn dump_archive(archive: String, verbose: bool) -> Result<(), Error> {
+fn dump_archive(archive: String) -> Result<(), Error> {
for entry in pxar::decoder::Decoder::open(archive)? {
let entry = entry?;
- if verbose {
- println!("{}", format_single_line_entry(&entry));
+ if log::log_enabled!(log::Level::Debug) {
+ log::debug!("{}", format_single_line_entry(&entry));
} else {
- println!("{:?}", entry.path());
+ log::info!("{:?}", entry.path());
}
}
Ok(())
let handle = if let Some(name) = param["drive"].as_str() {
let (config, _digest) = pbs_config::drive::config()?;
let drive: LtoTapeDrive = config.lookup("lto", name)?;
- eprintln!("using device {}", drive.path);
+ log::info!("using device {}", drive.path);
open_lto_tape_drive(&drive)?
} else if let Some(device) = param["device"].as_str() {
- eprintln!("using device {}", device);
+ log::info!("using device {}", device);
LtoTapeHandle::new(open_lto_tape_device(device)?)?
} else if let Some(true) = param["stdin"].as_bool() {
- eprintln!("using stdin");
+ log::info!("using stdin");
let fd = std::io::stdin().as_raw_fd();
let file = unsafe { File::from_raw_fd(fd) };
check_tape_is_lto_tape_device(&file)?;
} else if let Ok(name) = std::env::var("PROXMOX_TAPE_DRIVE") {
let (config, _digest) = pbs_config::drive::config()?;
let drive: LtoTapeDrive = config.lookup("lto", &name)?;
- eprintln!("using device {}", drive.path);
+ log::info!("using device {}", drive.path);
open_lto_tape_drive(&drive)?
} else {
let (config, _digest) = pbs_config::drive::config()?;
if drive_names.len() == 1 {
let name = drive_names[0];
let drive: LtoTapeDrive = config.lookup("lto", name)?;
- eprintln!("using device {}", drive.path);
+ log::info!("using device {}", drive.path);
open_lto_tape_drive(&drive)?
} else {
bail!("no drive/device specified");