Filter which excludes log messages which match the provided log levels.
| 65 | |
| 66 | |
| 67 | class LogLevelFilter(logging.Filter): |
| 68 | """ |
| 69 | Filter which excludes log messages which match the provided log levels. |
| 70 | """ |
| 71 | |
| 72 | def __init__(self, log_levels): |
| 73 | self._log_levels = log_levels |
| 74 | |
| 75 | def filter(self, record): |
| 76 | level = record.levelno |
| 77 | if level in self._log_levels: |
| 78 | return False |
| 79 | |
| 80 | return True |