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