2e284709c57ed32b974ad61d5177d674c961d7df
[imap-restore-mail] / warnings_handler.py
1 '''
2 restore-mail-inject.py - Tool to inject mails via IMAP
3
4 Copyright (c) 2012 Intra2net AG
5 '''
6 import logging
7
8 class WarningsHandler(logging.Handler):
9     """This class iterates through the e-mail files."""
10
11     # class attributes
12     detected_problems = None
13
14     def __init__(self):
15         """Initialize a handler to count number of warnings."""
16
17         logging.Handler.__init__(self)
18         self.detected_problems = 0
19
20     def emit(self, record):
21         """Increase number of warnings found"""
22
23         self.detected_problems += 1
24