# Skills logging (robot) This modded version of the JiboOS includes a tiny “always works” logging stack for the robot’s old BusyBox + Python 2.7 environment: - **UDP log daemon**: receives log messages and appends to a file - **Web log panel**: lets you watch the same logfile live in a browser - **Node helper**: a tiny client so JS skills can log without pain Default logfile: - `/tmp/jibo-skills.log` Default ports: - log daemon UDP: `15140` - web panel HTTP: `15150` ## 1) Start services on the robot - if you used the installer they should be enabled automatically ### Log daemon (required) Init.d: - `/etc/init.d/jibo-skills-logd start` - `/etc/init.d/jibo-skills-logd status` ### Web panel (optional) Init.d: - `/etc/init.d/jibo-skills-logpanel start` - `/etc/init.d/jibo-skills-logpanel status` Open in a browser: - `http://:15150/` ## 2) Send logs from programs ### Node.js (skills) Use the helper: - `const rlog = require('/opt/jibo/Jibo/Skills/@be/be/be/robot-logger');` API: - `rlog.info(tag, msg, data)` - `rlog.warn(tag, msg, data)` - `rlog.error(tag, msg, data)` - `rlog.debug(tag, msg, data)` - `rlog.raw(line)` (sends a plain text line) Examples: - `rlog.info('menu', 'opened main menu')` - `rlog.error('radio', 'failed to tune', { station: freq, err: String(e) })` One-liner test: - `node -e "require('/opt/jibo/Jibo/Skills/@be/be/be/robot-logger').info('node-test','hello testajhdgjhasgjd',{x:1})"` ### Python 2.7 Send a JSON log packet via UDP: - could be broken atm idk - `python -c 'import socket, time; s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM); s.sendto("{\\\"tag\\\":\\\"py-test\\\",\\\"level\\\":\\\"info\\\",\\\"msg\\\":\\\"hello\\\",\\\"data\\\":{\\\"t\\\":%d}}"%int(time.time()),("127.0.0.1",15140))'` ### Shell This bypasses UDP and just appends to the logfile (still useful to verify the panel is tailing): - `echo "RAW $(date) hello" >> /tmp/jibo-skills.log` ## 3) View logs - `tail -f /tmp/jibo-skills.log` ## 4) Configuration (env vars) Log daemon: - `JIBO_LOGD_HOST` (default `127.0.0.1`) - `JIBO_LOGD_PORT` (default `15140`) - `JIBO_LOGD_FILE` (default `/tmp/jibo-skills.log`) Web panel: - `JIBO_LOGPANEL_BIND` (default `0.0.0.0`) - `JIBO_LOGPANEL_PORT` (default `15150`) Node client: - `JIBO_LOGD_HOST` / `JIBO_LOGD_PORT` ## Notes - If the web panel shows `(polling)`, thats ok it means the browser doesn’t support SSE and it’s using `/tail` polling instead. - If the panel is blank, confirm `/tail` works: - `wget -qO- "http://127.0.0.1:15150/tail?pos=0&max=5000"`