From 7f6a7b664bbfe95a7052fab24499ed58732a1cfb Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 5 Dec 2022 16:19:57 +0100 Subject: log: add file handler for ogLive "real time log" Clients running in ogLive can show log messages via a lighttp server. Particularly, a html page named "real time log" consists of tags with the contents of two particular text files /tmp/session.log and /tmp/command.log Adds a Python logging handler in order to write ogClient log messages into /tmp/session.log. This way ogClient logs are show in the "real time log" html page too. --- src/log.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/log.py b/src/log.py index cabe4d0..e62da7f 100644 --- a/src/log.py +++ b/src/log.py @@ -58,8 +58,17 @@ def _default_logging_live(): 'filename': f'/opt/opengnsys/log/{getifaddr(os.getenv("DEVICE"))}.log', } } + rtlog = { + 'rtlog': { + 'class': 'logging.FileHandler', + 'formatter': 'formatter.syslogtime', + 'filename': f'/tmp/session.log', + } + } logconfig['handlers'].update(samba) + logconfig['handlers'].update(rtlog) logconfig['loggers']['']['handlers'].append('samba') + logconfig['loggers']['']['handlers'].append('rtlog') return logconfig -- cgit v1.2.3-18-g5258