Console logging from extensions

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

Console logging from extensions

Post by xtal256 » 2024-10-16, 21:05

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
Moon Magic practitioner
Posts: 2480
Joined: 2018-05-05, 13:29

Re: Console logging from extensions

Post by vannilla » 2024-10-16, 23:27

Look up nsIConsoleService on udn.realityripple.com.

xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

Re: Console logging from extensions

Post by xtal256 » 2024-10-17, 03:00

Thanks

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5688
Joined: 2015-12-09, 15:45

Re: Console logging from extensions

Post by moonbat » 2024-10-17, 04:51

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."

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