Advertisement
Guest User

Untitled

a guest
May 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. class ThresholdFilter(logging.Filter):
  2. """An instance of this class will allow the log results that equals to the threshold.
  3.  
  4. Attributes:
  5. acceptable_level: integer; logging level that will be accepted
  6. """
  7. def __init__(self, acceptable_level):
  8. """Acceptable threshold level.
  9.  
  10. Args:
  11. acceptable_level: int;logging level
  12. """
  13. self.acceptable_level = acceptable_level
  14.  
  15. def filter(self, record):
  16. """Filters the records by threshold.
  17.  
  18. Returns
  19. False if the log is to be suppressed; True if not
  20. """
  21. return self.acceptable_level == record.levelno
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement