This API method allows script authors simple access to logging informational messages in the Error Console via a chrome message.
If no messages are visible, make sure you navigate to about:config?filter=javascript.options.showInConsole and about:config?filter=javascript.options.strict change the values to true. This can be helpful for debugging.
⬆ ⬇ | Examples | GM_log and Firebug | See Also | Notes
GM_log( message )
Value: Function
Returns: undefined
Compatibility: Greasemonkey 0.3b - 3.12.0
Access: @grant
Parameters
| Properties |
|---|
| message |
Value: String, Integer or Boolean
Usage: message = "ARGHHH!";
GM_log("Hello, World!");
or
GM_log("Warning, " + someInputField.value + "!");
Since Firebug 1.0, extensions.firebug.showChromeMessages must be set to true for GM_log messages to show up in the Firebug console. It is also recommended to enable extensions.firebug.showChromeErrors, as doing so will reveal syntax errors and script breaks.
This can be done from about:config, or from the Firebug GUI. Go to the "Console" tab, then click the arrow next to the tab's name, and ensure that "Show Chrome Errors" and "Show Chrome Messages" are checked.
However, one should note that since GM_log converts any passed parameter to a string and resides in the chrome scheme. If Firebug is present on all systems it could be more advisable to simply use console.log, which will allow Firebug’s DOM Inspector on the logged objects. On sites with a large amount of warnings or errors this may cause the browser to hang.
Wiki: Greasemonkey_Manual:API
Wiki: Greasemonkey_Manual:Other_Useful_Tools
Wiki: Version_history