By default only brief logging output at verbosity 1 #283
No reviewers
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#283
Loading…
Reference in New Issue
No description provided.
Delete Branch "palto42/borgmatic:list-files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As discussed in PR #272 I changed the approach for more brief output at v1 level with "file list" and "stats" disabled by default.
The stats can be enabled with existing
--stats
option and for the file listing a new option--files
is added.Related tickets:
Lookin' good! Thanks for the PR.
@ -181,0 +181,4 @@
if logger.isEnabledFor(logging.INFO)
and not json
and not progress
and (files or logger.isEnabledFor(logging.DEBUG))
Potential simplification: You can probably remove the
if logger.isEnabledFor(logging.INFO)
check, given that Borg's--list --filter
works at verbosity 0, and it's now opt-in. Example revision:Agree, will change as suggested.
@ -208,3 +212,3 @@
if json:
output_log_level = None
elif stats:
elif stats and logger.getEffectiveLevel() == logging.WARNING:
Good call!
Based on this, I wonder though: Maybe the
--stats
option shouldn't influence the log level at all! For instance,--stats
works just fine at Borg's equivalent of verbosity 0.If removed, then no stats would be should at v0 since this only logs WARNING and all borg output would be logged as INFO.
This is fine for me since the used can now use v1 without the file details instead.
You are of course correct. Carry on!
FYI I think I'm going to put this line back. Having tried
--stats
at-v 0
, it's potentially confusing to the user why their requested stats aren't showing up.@ -61,1 +61,3 @@
+ (('--info', '--list') if logger.getEffectiveLevel() == logging.INFO else ())
+ (
('--stats',)
if not dry_run and logger.getEffectiveLevel() == logging.DEBUG or stats
Would be good to parenthesize the
logger.getEffectiveLevel() == logging.DEBUG or stats
part for clarity.@ -62,0 +64,4 @@
else ()
)
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--list',) if logger.getEffectiveLevel() == logging.INFO and files else ())
Shouldn't this be an
or
rather than anand
, so--files
works at multiple log levels? And forprune
, is the idea that the file listing should still be enabled atINFO
, rather than demoting it toDEBUG
like withcreate
?My intention was to only show the file listing at INFO and not at WARNING level. This is related to the old influence of the
--stats
option to change the logging level of the borg output. Since now--stats
has no influence on the borg output level anymore, I could simplify the condition toif files
.To make the code a bit more consistent I moved the
--list
out of extra DEBUG line similar as increate.py
:Looks good, thanks!
@ -71,1 +76,3 @@
output_log_level=logging.WARNING if stats else logging.INFO,
output_log_level=logging.WARNING
if (stats and logger.getEffectiveLevel() == logging.WARNING)
else logging.INFO,
If you decide that
--stats
shouldn't influence the log level (see comment above forcreate
), then this could be changed as well.Decided to remove the influence on log level.
I saw that in
create.py
there is a condition based onjson
which is not inprune.py
:Is this correct?
Just recognised that
prune.py
has no attributejson
, so all good.@ -1,6 +1,6 @@
from setuptools import find_packages, setup
VERSION = '1.4.22.dev0'
VERSION = '1.4.22.dev0-files'
If/when you merge this, it'd be good to remove the branch version tag.
I updated the code as per comments above and also aligned the impacted test cases for removed influence of
--stats
on the log level.Thanks again for all your hard work on this!
FYI: After playing around more with this some more, I decided to disable
borg --list
and--stats
by default at verbosity 2 as well! The rationale is that if a user has multiple different borgmatic log handlers going, e.g. console and syslog, or syslog and Healthchecks, then if any of those handlers are at verbosity 2, then all of them get file details and stats.. because borgmatic only invokes Borg once with a common set of parameters.So the "solution" I'm using is to make file details and stats 100% opt-in for all verbosity levels. The main downside is if you opt-in at all, you get it everywhere (all log handlers).
Shouldn't affect your use case, but thought you might be interested.