2 restore-mail-inject.py - Tool to inject mails via IMAP
4 Copyright (c) 2012 Intra2net AG
5 Author: Plamen Dimitrov and Thomas Jarosch
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
19 class WarningsHandler(logging.Handler):
20 """This class iterates through the e-mail files."""
23 detected_problems = None
26 """Initialize a handler to count number of warnings."""
28 logging.Handler.__init__(self)
29 self.detected_problems = 0
31 def emit(self, record):
32 """Increase number of warnings found"""
34 self.detected_problems += 1