This is all Plamen's work, I just contributed some ideas here and there
[imap-mark-seen] / src / warnings_handler.py
CommitLineData
6a1e092b 1'''
1d595a61 2The module contains the WarningsHandler class.
6a1e092b
PD
3
4Copyright (c) 2012 Intra2net AG
9bfaa115 5Author: Plamen Dimitrov
6a1e092b
PD
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 self.detected_problems += 1