summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-12-05 16:19:57 +0100
committerJose M. Guisado <jguisado@soleta.eu>2022-12-05 16:19:57 +0100
commit7f6a7b664bbfe95a7052fab24499ed58732a1cfb (patch)
tree2171bfc52146b9e95a0f980f9c00787fdae3fabb
parent70f1d0d71de033183fb2aed5533ec6937780a5a0 (diff)
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 <text-area> 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.
-rw-r--r--src/log.py9
1 files changed, 9 insertions, 0 deletions
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