mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Moved the disable method closer to its call site.
This commit is contained in:
parent
4dcc4dea87
commit
6d45897278
18
src/log.py
18
src/log.py
@ -90,15 +90,6 @@ class Logger(logging.Logger):
|
||||
|
||||
|
||||
class StdoutStreamHandler(logging.StreamHandler):
|
||||
def disable(self):
|
||||
self.setLevel(sys.maxint) # Just in case.
|
||||
_logger.removeHandler(self)
|
||||
logging._acquireLock()
|
||||
try:
|
||||
del logging._handlers[self]
|
||||
finally:
|
||||
logging._releaseLock()
|
||||
|
||||
def format(self, record):
|
||||
s = logging.StreamHandler.format(self, record)
|
||||
if record.levelname != 'ERROR' and conf.supybot.log.stdout.wrap():
|
||||
@ -122,6 +113,15 @@ class StdoutStreamHandler(logging.StreamHandler):
|
||||
error('Error logging to stdout. Removing stdout handler.')
|
||||
exception('Uncaught exception in StdoutStreamHandler:')
|
||||
|
||||
def disable(self):
|
||||
self.setLevel(sys.maxint) # Just in case.
|
||||
_logger.removeHandler(self)
|
||||
logging._acquireLock()
|
||||
try:
|
||||
del logging._handlers[self]
|
||||
finally:
|
||||
logging._releaseLock()
|
||||
|
||||
|
||||
class BetterFileHandler(logging.FileHandler):
|
||||
def emit(self, record):
|
||||
|
Loading…
Reference in New Issue
Block a user