| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Helper functions common to native, java and python test runners.""" | 5 """Helper functions common to native, java and host-driven test runners.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import time | 10 import time |
| 11 | 11 |
| 12 | 12 |
| 13 class CustomFormatter(logging.Formatter): | 13 class CustomFormatter(logging.Formatter): |
| 14 """Custom log formatter.""" | 14 """Custom log formatter.""" |
| 15 | 15 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 36 log_level = logging.WARNING # Default. | 36 log_level = logging.WARNING # Default. |
| 37 if verbose_count == 1: | 37 if verbose_count == 1: |
| 38 log_level = logging.INFO | 38 log_level = logging.INFO |
| 39 elif verbose_count >= 2: | 39 elif verbose_count >= 2: |
| 40 log_level = logging.DEBUG | 40 log_level = logging.DEBUG |
| 41 logger = logging.getLogger() | 41 logger = logging.getLogger() |
| 42 logger.setLevel(log_level) | 42 logger.setLevel(log_level) |
| 43 custom_handler = logging.StreamHandler(sys.stdout) | 43 custom_handler = logging.StreamHandler(sys.stdout) |
| 44 custom_handler.setFormatter(CustomFormatter()) | 44 custom_handler.setFormatter(CustomFormatter()) |
| 45 logging.getLogger().addHandler(custom_handler) | 45 logging.getLogger().addHandler(custom_handler) |
| OLD | NEW |