Merge pull request #2239 from redapple/streamlogger-flush

[MRG+1] Add flush() method to StreamLogger
This commit is contained in:
Mikhail Korobov 2016-09-19 14:44:45 +06:00 committed by GitHub
commit 490f6e08f3
1 changed files with 4 additions and 0 deletions

View File

@ -145,6 +145,10 @@ class StreamLogger(object):
for line in buf.rstrip().splitlines():
self.logger.log(self.log_level, line.rstrip())
def flush(self):
for h in self.logger.handlers:
h.flush()
class LogCounterHandler(logging.Handler):
"""Record log levels count into a crawler stats"""