Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ThresholdFilter(logging.Filter):
- """An instance of this class will allow the log results that equals to the threshold.
- Attributes:
- acceptable_level: integer; logging level that will be accepted
- """
- def __init__(self, acceptable_level):
- """Acceptable threshold level.
- Args:
- acceptable_level: int;logging level
- """
- self.acceptable_level = acceptable_level
- def filter(self, record):
- """Filters the records by threshold.
- Returns
- False if the log is to be suppressed; True if not
- """
- return self.acceptable_level == record.levelno
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement