kiwi.logger_filter
1# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. 2# 3# This file is part of kiwi. 4# 5# kiwi is free software: you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation, either version 3 of the License, or 8# (at your option) any later version. 9# 10# kiwi is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with kiwi. If not, see <http://www.gnu.org/licenses/> 17# 18import logging 19 20 21class LoggerSchedulerFilter(logging.Filter): 22 """ 23 **Extended standard logging Filter** 24 """ 25 def filter(self, record: logging.LogRecord) -> bool: 26 """ 27 Messages from apscheduler scheduler instances are filtered out 28 They conflict with console progress information 29 30 :param tuple record: logging message record 31 32 :return: True|False 33 34 :rtype: bool 35 """ 36 ignorables = [ 37 'apscheduler.scheduler', 38 'apscheduler.executors.default' 39 ] 40 return bool(record.name not in ignorables) 41 42 43class InfoFilter(logging.Filter): 44 """ 45 **Extended standard logging Filter** 46 """ 47 def filter(self, record: logging.LogRecord) -> bool: 48 """ 49 Only messages with record level INFO can pass 50 for messages with another level an extra handler is used 51 52 :param tuple record: logging message record 53 54 :return: True|False 55 56 :rtype: bool 57 """ 58 return True if record.levelno == logging.INFO else False 59 60 61class DebugFilter(logging.Filter): 62 """ 63 **Extended standard debug logging Filter** 64 """ 65 def filter(self, record: logging.LogRecord) -> bool: 66 """ 67 Only messages with record level DEBUG can pass 68 for messages with another level an extra handler is used 69 70 :param tuple record: logging message record 71 72 :return: True|False 73 74 :rtype: bool 75 """ 76 return True if record.levelno == logging.DEBUG else False 77 78 79class ErrorFilter(logging.Filter): 80 """ 81 **Extended standard error logging Filter** 82 """ 83 def filter(self, record: logging.LogRecord) -> bool: 84 """ 85 Only messages with record level DEBUG can pass 86 for messages with another level an extra handler is used 87 88 :param tuple record: logging message record 89 90 :return: True|False 91 92 :rtype: bool 93 """ 94 return True if record.levelno == logging.ERROR else False 95 96 97class WarningFilter(logging.Filter): 98 """ 99 **Extended standard warning logging Filter** 100 """ 101 def filter(self, record: logging.LogRecord) -> bool: 102 """ 103 Only messages with record level WARNING can pass 104 for messages with another level an extra handler is used 105 106 :param tuple record: logging message record 107 108 :return: True|False 109 110 :rtype: bool 111 """ 112 return True if record.levelno == logging.WARNING else False
22class LoggerSchedulerFilter(logging.Filter): 23 """ 24 **Extended standard logging Filter** 25 """ 26 def filter(self, record: logging.LogRecord) -> bool: 27 """ 28 Messages from apscheduler scheduler instances are filtered out 29 They conflict with console progress information 30 31 :param tuple record: logging message record 32 33 :return: True|False 34 35 :rtype: bool 36 """ 37 ignorables = [ 38 'apscheduler.scheduler', 39 'apscheduler.executors.default' 40 ] 41 return bool(record.name not in ignorables)
Extended standard logging Filter
26 def filter(self, record: logging.LogRecord) -> bool: 27 """ 28 Messages from apscheduler scheduler instances are filtered out 29 They conflict with console progress information 30 31 :param tuple record: logging message record 32 33 :return: True|False 34 35 :rtype: bool 36 """ 37 ignorables = [ 38 'apscheduler.scheduler', 39 'apscheduler.executors.default' 40 ] 41 return bool(record.name not in ignorables)
Messages from apscheduler scheduler instances are filtered out They conflict with console progress information
Parameters
- tuple record: logging message record
Returns
True|False
44class InfoFilter(logging.Filter): 45 """ 46 **Extended standard logging Filter** 47 """ 48 def filter(self, record: logging.LogRecord) -> bool: 49 """ 50 Only messages with record level INFO can pass 51 for messages with another level an extra handler is used 52 53 :param tuple record: logging message record 54 55 :return: True|False 56 57 :rtype: bool 58 """ 59 return True if record.levelno == logging.INFO else False
Extended standard logging Filter
48 def filter(self, record: logging.LogRecord) -> bool: 49 """ 50 Only messages with record level INFO can pass 51 for messages with another level an extra handler is used 52 53 :param tuple record: logging message record 54 55 :return: True|False 56 57 :rtype: bool 58 """ 59 return True if record.levelno == logging.INFO else False
Only messages with record level INFO can pass for messages with another level an extra handler is used
Parameters
- tuple record: logging message record
Returns
True|False
62class DebugFilter(logging.Filter): 63 """ 64 **Extended standard debug logging Filter** 65 """ 66 def filter(self, record: logging.LogRecord) -> bool: 67 """ 68 Only messages with record level DEBUG can pass 69 for messages with another level an extra handler is used 70 71 :param tuple record: logging message record 72 73 :return: True|False 74 75 :rtype: bool 76 """ 77 return True if record.levelno == logging.DEBUG else False
Extended standard debug logging Filter
66 def filter(self, record: logging.LogRecord) -> bool: 67 """ 68 Only messages with record level DEBUG can pass 69 for messages with another level an extra handler is used 70 71 :param tuple record: logging message record 72 73 :return: True|False 74 75 :rtype: bool 76 """ 77 return True if record.levelno == logging.DEBUG else False
Only messages with record level DEBUG can pass for messages with another level an extra handler is used
Parameters
- tuple record: logging message record
Returns
True|False
80class ErrorFilter(logging.Filter): 81 """ 82 **Extended standard error logging Filter** 83 """ 84 def filter(self, record: logging.LogRecord) -> bool: 85 """ 86 Only messages with record level DEBUG can pass 87 for messages with another level an extra handler is used 88 89 :param tuple record: logging message record 90 91 :return: True|False 92 93 :rtype: bool 94 """ 95 return True if record.levelno == logging.ERROR else False
Extended standard error logging Filter
84 def filter(self, record: logging.LogRecord) -> bool: 85 """ 86 Only messages with record level DEBUG can pass 87 for messages with another level an extra handler is used 88 89 :param tuple record: logging message record 90 91 :return: True|False 92 93 :rtype: bool 94 """ 95 return True if record.levelno == logging.ERROR else False
Only messages with record level DEBUG can pass for messages with another level an extra handler is used
Parameters
- tuple record: logging message record
Returns
True|False
98class WarningFilter(logging.Filter): 99 """ 100 **Extended standard warning logging Filter** 101 """ 102 def filter(self, record: logging.LogRecord) -> bool: 103 """ 104 Only messages with record level WARNING can pass 105 for messages with another level an extra handler is used 106 107 :param tuple record: logging message record 108 109 :return: True|False 110 111 :rtype: bool 112 """ 113 return True if record.levelno == logging.WARNING else False
Extended standard warning logging Filter
102 def filter(self, record: logging.LogRecord) -> bool: 103 """ 104 Only messages with record level WARNING can pass 105 for messages with another level an extra handler is used 106 107 :param tuple record: logging message record 108 109 :return: True|False 110 111 :rtype: bool 112 """ 113 return True if record.levelno == logging.WARNING else False
Only messages with record level WARNING can pass for messages with another level an extra handler is used
Parameters
- tuple record: logging message record
Returns
True|False