support lower verbosity #236
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#236
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
What I'm trying to do and why
I would like to restrict the console output to ERROR level if borgmatic is used in cron.
Currently the lowest verbosity 0 translates to the logging level WARNING which causes the
--stats
option to be displayed on all log outputs (console and syslog/logfile).If the console level could be set to ERROR and syslog uses default 0=WARNING, then the
--stats
option would only add the statistics to syslog. Errors and critical messages would still show on the console as well (and trigger an email in cron).Implementation idea
Add support for the verbosity -1 and map it to logging level ERROR.
Although negative verbosity might look strange, it would be consistent with current behavior and is backwards compatible.
That makes sense to me. It's similar in spirit to
curl --silent
or the--quiet
flag of various programs. Sounds like it'd be pretty straight-forward to implement too. Are you interested in taking a crack at it?New PR #237 for this feature.
Was not sure how should the help text describe the level -1, used option 1 in PR.
Display verbose progress to the console (from none to lots: 0, 1, or 2) or only errors (-1)
Display verbose progress to the console (from error-only to lots: -1, 0, 1, or 2)
Looking at the latest code I found that you defined the default
log-file-verbosity
as 1 instead of 0 like for the others. To me this looks inconsistent and I would prefer to align it with the other 2 cases as default 0.Thanks, I will check out the PR when I get a chance!
Seems reasonable.
My rationale for making it inconsistent at 1 was as follows: When logging to syslog, which is implicit, you might not want it to always spew info logs there. So the default is 0. But when logging to a file with
--log-file
, you're explicitly requesting that logs go to the file. And so it might be unexpected to a user to specify an explicit--log-file
and then see no logs show up there (except warnings/errors)! In fact, the first few times I used--log-file
, I said to myself: Is this even working? The file is zero bytes.Having said all that, I don't feel strongly about it, so feel free to make it consistent if you like! After all, you are the primary user of the
--log-file
flag at this moment in time.Just released in borgmatic 1.4.6. Nice work!