bc6af31a86d0a7e00d42669981209b4b8a2b8f58
[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         logging.Handler.__init__(self)
17         self.detected_problems = 0
18
19     def emit(self, record):
20         """Increase number of warnings found"""
21         self.detected_problems += 1
22