While debugging regular parts of your app, thanks to WebIDE, is much easier as you can see results of your console.log
s but having logs of your service worker, which I call SW from now on, is a bit tricky.
Gecko logs its stuff to ADB's logcat
instead of writing it to stdout
or stderr
and it has been a long time being like this. But to see the logs you must enable 2 preferences:
consoleservice.enabled
consoleservice.logcat
Feel free to create them as boolean preferences if they are not already there. Afterwards, assuming you're on Linux or any other Unix-like OS:
adb logcat '*:V' | grep Chooj
Where Chooj
is replaced with the name of your app.
[19:04:05]:~/playground/chooj/src$ adb logcat '*:V' | grep Chooj
94:12-09 20:28:28.765 6657 6657 I Chooj : Content JS LOG: TURN creds are valid for another 2400612 ms: not fetching new ones.
95:12-09 20:28:28.765 6657 6657 I Chooj : at ["./node_modules/matrix-js-sdk/lib/logger.js"]/_loglevel.default.methodFactory/< (app://chooj.bananahackers.net/static/js/0.chunk.js:94358:15)
941:12-09 20:38:28.765 6657 6657 I Chooj : Content JS LOG: TURN creds are valid for another 1800612 ms: not fetching new ones.
942:12-09 20:38:28.765 6657 6657 I Chooj : at ["./node_modules/matrix-js-sdk/lib/logger.js"]/_loglevel.default.methodFactory/< (app://chooj.bananahackers.net/static/js/0.chunk.js:94358:15)
It might be a good idea to prefix all SW messages with something like [Chooj SW]
which is so easy to grep
.