GM log: Difference between revisions
From GreaseSpot Wiki
Jump to navigationJump to search
Removed level argument - apparently not supported, see discussion. |
Symmetry update |
||
Line 1: | Line 1: | ||
{{underscore|title=GM_log}} | {{underscore|title=GM_log}} | ||
__NOTOC__ | |||
= Syntax = | == Description == | ||
This [[API_reference|API]] method allows script authors simple access to logging informational messages in the Error Console. | |||
If you aren't seeing your messages, make sure you navigate to [[mozillazine:About:config|about:config]], and change the values of <code>javascript.options.showInConsole</code> and <code>javascript.options.strict</code> to true. This can be helpful for debugging. | |||
[[#Examples|Examples]] | [[#GM_log_and_Firebug|GM_log and Firebug]] | [[#Notes|Notes]] | |||
== Syntax == | |||
'''GM_log(''' ''message'' ''')''' | '''GM_log(''' ''message'' ''')''' | ||
:Value: Function | |||
:Returns: Nothing | |||
:Compatibility: [[Version_history#0.3_beta|Greasemonkey 0.3b+]] | |||
:{| border="1" cellpadding="5" | |||
|+ Parameters | |||
!|'''Properties''' | |||
|- | |||
| <code>[[#message |message]]</code> | |||
|} | |||
:* All properties are optional except [[#message|message]]. | |||
[[#Description|top]] | |||
=== Properties === | |||
---- | |||
==== <code>message</code> ==== | |||
:Value: String | |||
:Usage: <code>'''message''' = "ARGHHH!";</code> | |||
:* Message to send to the JavaScript error console. | |||
[[#Description|top]] | [[#Syntax|back]]'' | |||
== Examples == | |||
<code><pre> | |||
GM_log("Hello, World!"); | GM_log("Hello, World!"); | ||
</pre></code> | |||
<code><pre> | |||
GM_log("Warning, " + someInputField.value + "!"); | |||
</pre></code> | |||
[[#Description|top]] | |||
= | == GM_log and Firebug == | ||
Since [https://addons.mozilla.org/en-US/firefox/addon/1843 Firebug] 1.0, <code>extensions.firebug.showChromeMessages</code> must be set to <code>true</code> for GM_log messages to show up in the Firebug console. | |||
[[#Description|top]] | |||
= | == Notes == | ||
[[Category: | [[#Description|top]] | ||
[[Category:API_Reference|G]] |
Revision as of 06:38, 7 December 2007
Description
This API method allows script authors simple access to logging informational messages in the Error Console.
If you aren't seeing your messages, make sure you navigate to about:config, and change the values of javascript.options.showInConsole
and javascript.options.strict
to true. This can be helpful for debugging.
Examples | GM_log and Firebug | Notes
Syntax
GM_log( message )
- Value: Function
- Returns: Nothing
- Compatibility: Greasemonkey 0.3b+
Parameters Properties message
- All properties are optional except message.
Properties
message
- Value: String
- Usage:
message = "ARGHHH!";
- Message to send to the JavaScript error console.
Examples
GM_log("Hello, World!");
GM_log("Warning, " + someInputField.value + "!");
GM_log and Firebug
Since Firebug 1.0, extensions.firebug.showChromeMessages
must be set to true
for GM_log messages to show up in the Firebug console.