OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 # that can be found in the LICENSE file. |
4 | 4 |
5 """Utilities for logging. | 5 """Utilities for logging. |
6 | 6 |
7 Example usage: | 7 Example usage: |
8 | 8 |
9 .. code-block:: python | 9 .. code-block:: python |
10 | 10 |
11 import argparse | 11 import argparse |
12 import logging | 12 import logging |
13 import infra_libs.logs | 13 import infra_libs.logs |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 for level in file_levels: | 286 for level in file_levels: |
287 add_handler( | 287 add_handler( |
288 logger, | 288 logger, |
289 handler=logging.handlers.RotatingFileHandler( | 289 handler=logging.handlers.RotatingFileHandler( |
290 filename=os.path.join( | 290 filename=os.path.join( |
291 logs_directory, pattern % logging.getLevelName(level)), | 291 logs_directory, pattern % logging.getLevelName(level)), |
292 maxBytes=10 * 1024 * 1024, | 292 maxBytes=10 * 1024 * 1024, |
293 backupCount=10, | 293 backupCount=10, |
294 delay=True), | 294 delay=True), |
295 level=level) | 295 level=level) |
OLD | NEW |