By default only brief logging output at verbosity 1 #283
No reviewers
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
borgmatic-collective/borgmatic!283
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch ":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
--statsoption and for the file listing a new option--filesis added.Related tickets:
Lookin' good! Thanks for the PR.
@ -181,0 +181,4 @@if logger.isEnabledFor(logging.INFO)and not jsonand not progressand (files or logger.isEnabledFor(logging.DEBUG))Potential simplification: You can probably remove the
if logger.isEnabledFor(logging.INFO)check, given that Borg's--list --filterworks 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 = Noneelif stats:elif stats and logger.getEffectiveLevel() == logging.WARNING:Good call!
Based on this, I wonder though: Maybe the
--statsoption shouldn't influence the log level at all! For instance,--statsworks 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
--statsat-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 statsWould be good to parenthesize the
logger.getEffectiveLevel() == logging.DEBUG or statspart 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
orrather than anand, so--filesworks at multiple log levels? And forprune, is the idea that the file listing should still be enabled atINFO, rather than demoting it toDEBUGlike 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
--statsoption to change the logging level of the borg output. Since now--statshas 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
--listout 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.WARNINGif (stats and logger.getEffectiveLevel() == logging.WARNING)else logging.INFO,If you decide that
--statsshouldn'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.pythere is a condition based onjsonwhich is not inprune.py:Is this correct?
Just recognised that
prune.pyhas no attributejson, so all good.@ -1,6 +1,6 @@from setuptools import find_packages, setupVERSION = '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
--statson 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 --listand--statsby 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.