OLD | NEW |
1 # Copyright 2015 The Swarming Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 that | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # can be found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Utility relating to logging.""" | 5 """Utility relating to logging.""" |
6 | 6 |
7 import argparse | 7 import argparse |
8 import codecs | 8 import codecs |
9 import ctypes | 9 import ctypes |
10 import logging | 10 import logging |
11 import logging.handlers | 11 import logging.handlers |
12 import optparse | 12 import optparse |
13 import os | 13 import os |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 def parse_args(self, *args, **kwargs): | 292 def parse_args(self, *args, **kwargs): |
293 # Make sure this group is always the last one. | 293 # Make sure this group is always the last one. |
294 self._add_logging_group() | 294 self._add_logging_group() |
295 | 295 |
296 args = super(ArgumentParserWithLogging, self).parse_args(*args, **kwargs) | 296 args = super(ArgumentParserWithLogging, self).parse_args(*args, **kwargs) |
297 prepare_logging(self.enable_log_file and args.log_file, self.logger_root) | 297 prepare_logging(self.enable_log_file and args.log_file, self.logger_root) |
298 set_console_level( | 298 set_console_level( |
299 LEVELS[min(len(LEVELS) - 1, args.verbose)], self.logger_root) | 299 LEVELS[min(len(LEVELS) - 1, args.verbose)], self.logger_root) |
300 return args | 300 return args |
OLD | NEW |