mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-25 18:00:39 +01:00
log: flush the log queue AFTER setting up file loggers
This makes sure that messages sent during the config phase are logged to files, not just the console. TODO: We should actually be extending this to log to IRC too...
This commit is contained in:
parent
6e8f618f80
commit
caade5a308
14
log.py
14
log.py
@ -42,13 +42,6 @@ log.addHandler(world.stdout_handler)
|
|||||||
# the root logger. https://stackoverflow.com/questions/16624695
|
# the root logger. https://stackoverflow.com/questions/16624695
|
||||||
log.setLevel(1)
|
log.setLevel(1)
|
||||||
|
|
||||||
log.debug("log: Emptying log_queue")
|
|
||||||
# Process and empty the log queue
|
|
||||||
while world.log_queue:
|
|
||||||
level, text = world.log_queue.popleft()
|
|
||||||
log.log(level, text)
|
|
||||||
log.debug("log: Emptied log_queue")
|
|
||||||
|
|
||||||
def makeFileLogger(filename, level=None):
|
def makeFileLogger(filename, level=None):
|
||||||
"""
|
"""
|
||||||
Initializes a file logging target with the given filename and level.
|
Initializes a file logging target with the given filename and level.
|
||||||
@ -95,6 +88,13 @@ if files:
|
|||||||
for filename, config in files.items():
|
for filename, config in files.items():
|
||||||
makeFileLogger(filename, config.get('loglevel'))
|
makeFileLogger(filename, config.get('loglevel'))
|
||||||
|
|
||||||
|
log.debug("log: Emptying log_queue")
|
||||||
|
# Process and empty the log queue
|
||||||
|
while world.log_queue:
|
||||||
|
level, text = world.log_queue.popleft()
|
||||||
|
log.log(level, text)
|
||||||
|
log.debug("log: Emptied log_queue")
|
||||||
|
|
||||||
class PyLinkChannelLogger(logging.Handler):
|
class PyLinkChannelLogger(logging.Handler):
|
||||||
"""
|
"""
|
||||||
Log handler to log to channels in PyLink.
|
Log handler to log to channels in PyLink.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user