浏览代码

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)
Antoine Beaupré 10 年之前
父节点
当前提交
8d3d1c22d6
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 3 3
      borg/archiver.py
  2. 3 3
      borg/testsuite/archiver.py

+ 3 - 3
borg/archiver.py

@@ -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,

+ 3 - 3
borg/testsuite/archiver.py

@@ -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)