feedback-bot: Fix indentation of StreamLogger code.
(imported from commit 8bb1d04257c12fb2787349cd2d049e52e96a23b0)
This commit is contained in:
parent
d5d4edfbe3
commit
db4ff2ce56
|
@ -7,20 +7,20 @@ sys.path.append(path.join(path.dirname(__file__), '..'))
|
|||
import humbug
|
||||
|
||||
class StreamLogger(object):
|
||||
"""
|
||||
Give a file-like interface to a logger instance.
|
||||
"""
|
||||
def __init__(self, logger, log_level=logging.INFO):
|
||||
self.logger = logger
|
||||
self.log_level = log_level
|
||||
self.buffer = ""
|
||||
"""
|
||||
Give a file-like interface to a logger instance.
|
||||
"""
|
||||
def __init__(self, logger, log_level=logging.INFO):
|
||||
self.logger = logger
|
||||
self.log_level = log_level
|
||||
self.buffer = ""
|
||||
|
||||
def write(self, message):
|
||||
self.buffer += message
|
||||
def write(self, message):
|
||||
self.buffer += message
|
||||
|
||||
if message[-1] == "\n":
|
||||
self.logger.log(self.log_level, self.buffer.rstrip())
|
||||
self.buffer = ""
|
||||
if message[-1] == "\n":
|
||||
self.logger.log(self.log_level, self.buffer.rstrip())
|
||||
self.buffer = ""
|
||||
|
||||
logging.basicConfig(filename="/var/log/humbug/feedback-bot.log",
|
||||
level=logging.DEBUG, format="%(asctime)s %(levelname)s\t%(message)s")
|
||||
|
|
Loading…
Reference in a new issue