public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH-SERIES] replace print by log macro in libraries
Date: Fri, 18 Mar 2022 07:02:11 +0100	[thread overview]
Message-ID: <72a44e18-e02f-b692-1f3d-da65ca35f6db@proxmox.com> (raw)
In-Reply-To: <20220317084057.i64ce6w32su6vfh5@wobu-vie.proxmox.com>



Am 17.03.22 um 09:40 schrieb Wolfgang Bumiller:
> I like the direction of this.
> 
> On Fri, Mar 11, 2022 at 03:07:45PM +0000, Hannes Laimer wrote:
>> This series mostly replaces print with the log macro in libs, it also replaces print
>> in binaries where it is used to log stuff and not output the result of a command.
>> In the process of replacing prints by log macros a few parameters controlling verbosity
>> became obsolete and were removed, other 'verbose' parameters influenced the control
>> flow and where therefore kept.
> 
> Where does verbosity affect control flow? That sounds strange.
> 
> And I don't think we should just *drop* `--verbose` parameters. I do
> think it would be good to *have* them, either by promoting
> previously-verbose output to `log::debug` and making the parameter
> affect the filter, or by using a task-local variable we don't need to
> hand down through all the function calls, though the latter might be a
> bit more involved (given that eg. tokio's LocalKey is not inherited
> across `spawn()`...)
> 
Logging output that was behind a `if verbose..` was replaced with a 
log::debug, I should have mentioned that in the summary. If the 
`verbose` parameter was used to define the commands result(e.g. 
proxmox-backup-manager version) it was kept.

In [1] we only return if self.verbose is true, looking at it again maybe 
renaming verbose to foreground(or smth similar) might make sense here... 
but not sure.
>> The whole changes were split up into 7 seperate patches[3-9], this was done
>> to aviod one huge patch file and improve readability. Those (maybe also 2)
>> should be squashed when applied since they are not necesarilly buildable.
>> The reason for that is that in a few places 'verbose' parameters were remove.
>>
>> A verion bump is also needed since patches 2 (and indirectly 3-10) depend on
>> the function added to proxmox-router in patch 1.
> 
> As for the helper... I'm a bit unsure here.
> We currently always pass "info", and we use "PBS_LOG" as env var
> everywhere except the pxar binary.
> 
> While on the one hand flexibility would be nice... I think we could
> also just drop the parameters (or make them `Option`s)?
I wanted to keep it as general as possible, since it is in a not PBS 
specific crate, but Option makes sense for the verbosity level, env var 
name 'PBS_LOG' outside of PBS seems out of place. 
(init_cli_logger('LOGLVL', None) might look a little weird though...)

[1] 
https://git.proxmox.com/?p=proxmox-backup.git;a=blob;f=pbs-client/src/pxar/fuse.rs;h=0b90ff2ce36c87b2a7fbd208e581c33700a7e9e1;hb=refs/heads/master#l299




  reply	other threads:[~2022-03-18  6:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 15:07 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 ` [pbs-devel] [PATCH proxmox-backup 04/10] pbs-datastore: " Hannes Laimer
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 [this message]
2022-05-10  9:01 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=72a44e18-e02f-b692-1f3d-da65ca35f6db@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal