| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Adds logging formatException() filtering to reduce the file paths length in | 5 """Adds logging formatException() filtering to reduce the file paths length in |
| 6 error logged. | 6 error logged. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| 11 import re | 11 import re |
| 12 | 12 |
| 13 import webapp2 | 13 import webapp2 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 This is optional but helps reduce spam significantly so it is highly | 96 This is optional but helps reduce spam significantly so it is highly |
| 97 encouraged. | 97 encouraged. |
| 98 """ | 98 """ |
| 99 for handler in logging.getLogger().handlers: | 99 for handler in logging.getLogger().handlers: |
| 100 # pylint: disable=W0212 | 100 # pylint: disable=W0212 |
| 101 formatter = handler.formatter or logging._defaultFormatter | 101 formatter = handler.formatter or logging._defaultFormatter |
| 102 if not isinstance(formatter, _Formatter): | 102 if not isinstance(formatter, _Formatter): |
| 103 # Prevent immediate recursion. | 103 # Prevent immediate recursion. |
| 104 handler.setFormatter(_Formatter(formatter)) | 104 handler.setFormatter(_Formatter(formatter)) |
| OLD | NEW |