[pbs-devel] [PATCH proxmox-backup rebased 8/9] replace print with log macro

Wolfgang Bumiller w.bumiller at proxmox.com
Tue May 31 10:42:22 CEST 2022


On Tue, May 10, 2022 at 09:01:57AM +0000, Hannes Laimer wrote:
> diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
> index bad68f24..e96ea13e 100644
> --- a/pxar-bin/src/main.rs
> +++ b/pxar-bin/src/main.rs
(...)
> @@ -419,24 +397,16 @@ async fn mount_archive(archive: String, mountpoint: String, verbose: bool) -> Re
>              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));
> -        } else {
> -            println!("{:?}", entry.path());
> -        }
> +        log::debug!("{}", format_single_line_entry(&entry));
> +        log::info!("{:?}", entry.path());

^ here is probably also better to keep the condition with
`log_enabled!(Debug)` rather than having double the lines in debug mode.

>      }
>      Ok(())
>  }





More information about the pbs-devel mailing list