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
|
import humbug
|
||||||
|
|
||||||
class StreamLogger(object):
|
class StreamLogger(object):
|
||||||
"""
|
"""
|
||||||
Give a file-like interface to a logger instance.
|
Give a file-like interface to a logger instance.
|
||||||
"""
|
"""
|
||||||
def __init__(self, logger, log_level=logging.INFO):
|
def __init__(self, logger, log_level=logging.INFO):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.log_level = log_level
|
self.log_level = log_level
|
||||||
self.buffer = ""
|
self.buffer = ""
|
||||||
|
|
||||||
def write(self, message):
|
def write(self, message):
|
||||||
self.buffer += message
|
self.buffer += message
|
||||||
|
|
||||||
if message[-1] == "\n":
|
if message[-1] == "\n":
|
||||||
self.logger.log(self.log_level, self.buffer.rstrip())
|
self.logger.log(self.log_level, self.buffer.rstrip())
|
||||||
self.buffer = ""
|
self.buffer = ""
|
||||||
|
|
||||||
logging.basicConfig(filename="/var/log/humbug/feedback-bot.log",
|
logging.basicConfig(filename="/var/log/humbug/feedback-bot.log",
|
||||||
level=logging.DEBUG, format="%(asctime)s %(levelname)s\t%(message)s")
|
level=logging.DEBUG, format="%(asctime)s %(levelname)s\t%(message)s")
|
||||||
|
|
Loading…
Reference in a new issue