Expose all logs to frontend instead of only maubot.*
This commit is contained in:
parent
0779b38b7a
commit
58fedc7e8c
@ -109,19 +109,18 @@ class LogCollector(logging.Handler):
|
|||||||
|
|
||||||
|
|
||||||
handler = LogCollector()
|
handler = LogCollector()
|
||||||
log_root = logging.getLogger("maubot")
|
|
||||||
log = logging.getLogger("maubot.server.websocket")
|
log = logging.getLogger("maubot.server.websocket")
|
||||||
sockets = []
|
sockets = []
|
||||||
|
|
||||||
|
|
||||||
def init(loop: asyncio.AbstractEventLoop) -> None:
|
def init(loop: asyncio.AbstractEventLoop) -> None:
|
||||||
log_root.addHandler(handler)
|
logging.root.addHandler(handler)
|
||||||
handler.loop = loop
|
handler.loop = loop
|
||||||
|
|
||||||
|
|
||||||
async def stop_all() -> None:
|
async def stop_all() -> None:
|
||||||
log.debug("Closing log listener websockets")
|
log.debug("Closing log listener websockets")
|
||||||
log_root.removeHandler(handler)
|
logging.root.removeHandler(handler)
|
||||||
for socket in sockets:
|
for socket in sockets:
|
||||||
try:
|
try:
|
||||||
await socket.close(code=1012)
|
await socket.close(code=1012)
|
||||||
|
Loading…
Reference in New Issue
Block a user