mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Made stdout stuff dynamically check the value of supybot.log.stdout.
This commit is contained in:
parent
651db477ae
commit
92b2bd31cf
@ -81,6 +81,11 @@ class BetterStreamHandler(logging.StreamHandler):
|
|||||||
self.stream.write("%s\n" % msg.encode("UTF-8"))
|
self.stream.write("%s\n" % msg.encode("UTF-8"))
|
||||||
self.flush()
|
self.flush()
|
||||||
|
|
||||||
|
class StdoutStreamHandler(BetterStreamHandler):
|
||||||
|
def emit(self, record):
|
||||||
|
if conf.supybot.log.stdout():
|
||||||
|
BetterStreamHandler.emit(self, record)
|
||||||
|
|
||||||
|
|
||||||
class BetterFileHandler(logging.FileHandler):
|
class BetterFileHandler(logging.FileHandler):
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
@ -231,8 +236,7 @@ _handler.setLevel(-1)
|
|||||||
_logger.addHandler(_handler)
|
_logger.addHandler(_handler)
|
||||||
_logger.setLevel(conf.supybot.log.level())
|
_logger.setLevel(conf.supybot.log.level())
|
||||||
|
|
||||||
if conf.supybot.log.stdout():
|
_stdoutHandler = StdoutStreamHandler(sys.stdout)
|
||||||
_stdoutHandler = BetterStreamHandler(sys.stdout)
|
|
||||||
_formatString = '%(name)s: %(levelname)s %(message)s'
|
_formatString = '%(name)s: %(levelname)s %(message)s'
|
||||||
_stdoutFormatter = ColorizedFormatter(_formatString)
|
_stdoutFormatter = ColorizedFormatter(_formatString)
|
||||||
_stdoutHandler.setFormatter(_stdoutFormatter)
|
_stdoutHandler.setFormatter(_stdoutFormatter)
|
||||||
|
Loading…
Reference in New Issue
Block a user