silence borg by default

this also prints file status on stderr directly, bypassing the logger
as we do with other topical flags (like progress and status)
This commit is contained in:
Antoine Beaupré 2015-11-23 12:38:11 -05:00
parent 9899eaf241
commit 8d3d1c22d6
2 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,7 @@ class Archiver:
def print_file_status(self, status, path):
if self.args.changed:
logger.info("%1s %s" % (status, remove_surrogates(path)))
print("%1s %s" % (status, remove_surrogates(path)), file=sys.stderr)
def do_serve(self, args):
"""Start in server mode. This command is usually not used manually.
@ -663,9 +663,9 @@ 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',
action='store_const', const='info', default='info',
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='info', metavar='LEVEL',
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)')
common_parser.add_argument('--lock-wait', dest='lock_wait', type=int, metavar='N', default=1,

View File

@ -947,13 +947,13 @@ class ArchiverCheckTestCase(ArchiverTestCaseBase):
return archive, repository
def test_check_usage(self):
output = self.cmd('check', self.repository_location, exit_code=0)
output = self.cmd('check', '--log-level=info', 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', '--repository-only', self.repository_location, exit_code=0)
output = self.cmd('check', '--log-level=info', '--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', '--archives-only', self.repository_location, exit_code=0)
output = self.cmd('check', '--log-level=info', '--archives-only', self.repository_location, exit_code=0)
self.assert_not_in('Starting repository check', output)
self.assert_in('Starting archive consistency check', output)