Console logging from extensions
Moderators: FranklinDM, Lootyhoof
-
xtal256
- Moon lover

- Posts: 95
- Joined: 2014-06-22, 00:32
- Location: here
Console logging from extensions
I want to add logging to an extension so I can debug it, but when I did console.log then looked at the console in Browser Toolbox (i.e. the Developer Tools window that inspects the browser itself) it just said console is undefined. Is there some other logging mechanism I should be using? Is there a documentation page someone can point me to (even if it's an old Firefox one)?
-
vannilla
- Moon Magic practitioner

- Posts: 2480
- Joined: 2018-05-05, 13:29
Re: Console logging from extensions
Look up nsIConsoleService on udn.realityripple.com.
-
xtal256
- Moon lover

- Posts: 95
- Joined: 2014-06-22, 00:32
- Location: here
-
moonbat
- Knows the dark side

- Posts: 5688
- Joined: 2015-12-09, 15:45
Re: Console logging from extensions
Look up Services.jsm, once you import it you can simply access the cached copy of various services without having to instantiate them. So after importing this module, you would just use Services.console to access nsIConsoleService.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net

KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net