remove --log-level, add --debug and --info option, update docs

removed --log-level due to overlap with how --verbose works now.

for consistency, added --info as alias to --verbose (as the effect is
setting INFO log level).

also added --debug which sets DEBUG log level.
note: there are no messages emitted at DEBUG level yet.

WARNING is the default (because we want mostly silent behaviour,
except if something serious happens), so we don't need --warning
as an option.
This commit is contained in:
Thomas Waldmann 2015-12-08 01:37:34 +01:00
parent 68225af449
commit cb821b119b
4 changed files with 23 additions and 13 deletions

View File

@ -664,12 +664,12 @@ class Archiver:
def build_parser(self, args=None, prog=None):
common_parser = argparse.ArgumentParser(add_help=False, prog=prog)
common_parser.add_argument('-v', '--verbose', dest='log_level',
common_parser.add_argument('-v', '--verbose', '--info', dest='log_level',
action='store_const', const='info', default='warning',
help='verbose output, same as --log-level=info')
common_parser.add_argument('--log-level', dest='log_level', default='warning', metavar='LEVEL',
choices=('debug', 'info', 'warning', 'error', 'critical'),
help='set the log level to LEVEL, default: %(default)s)')
help='enable informative (verbose) output, work on log level INFO')
common_parser.add_argument('--debug', dest='log_level',
action='store_const', const='debug', default='warning',
help='enable debug output, work on log level DEBUG')
common_parser.add_argument('--lock-wait', dest='lock_wait', type=int, metavar='N', default=1,
help='wait for the lock, but max. N seconds (default: %(default)d).')
common_parser.add_argument('--show-rc', dest='show_rc', action='store_true', default=False,

View File

@ -950,13 +950,13 @@ class ArchiverCheckTestCase(ArchiverTestCaseBase):
return archive, repository
def test_check_usage(self):
output = self.cmd('check', '--log-level=info', self.repository_location, exit_code=0)
output = self.cmd('check', '-v', self.repository_location, exit_code=0)
self.assert_in('Starting repository check', output)
self.assert_in('Starting archive consistency check', output)
output = self.cmd('check', '--log-level=info', '--repository-only', self.repository_location, exit_code=0)
output = self.cmd('check', '-v', '--repository-only', self.repository_location, exit_code=0)
self.assert_in('Starting repository check', output)
self.assert_not_in('Starting archive consistency check', output)
output = self.cmd('check', '--log-level=info', '--archives-only', self.repository_location, exit_code=0)
output = self.cmd('check', '-v', '--archives-only', self.repository_location, exit_code=0)
self.assert_not_in('Starting repository check', output)
self.assert_in('Starting archive consistency check', output)

View File

@ -25,7 +25,9 @@ New features:
- implement borg break-lock command, fixes #157
- include system info below traceback, fixes #324
- use ISO-8601 date and time format, fixes #375
- add --log-level to set the level of the builtin logging configuration, fixes #426
- add --debug and --info (same as --verbose) to set the log level of the
builtin logging configuration (which otherwise defaults to warning),
fixes #426
- configure logging via env var BORG_LOGGING_CONF
- add a --no-progress flag to forcibly disable progress info

View File

@ -14,12 +14,20 @@ General
Type of log output
~~~~~~~~~~~~~~~~~~
You can set the log level of the builtin logging configuration using the
--log-level option.
The log level of the builtin logging configuration defaults to WARNING.
This is because we want |project_name| to be mostly silent and only output
warnings (plus errors and critical messages).
Supported levels: ``debug``, ``info``, ``warning``, ``error``, ``critical``.
Use --verbose or --info to set INFO (you will get informative output then
additionally to warnings, errors, critical messages).
Use --debug to set DEBUG to get output made for debugging.
All log messages created with at least the given level will be output.
All log messages created with at least the set level will be output.
Log levels: DEBUG < INFO < WARNING < ERROR < CRITICAL
While you can set misc. log levels, do not expect that every command will
give different output on different log levels - it's just a possibility.
Return codes
~~~~~~~~~~~~