Difference between revisions of "GM log"

From GreaseSpot Wiki
Jump to navigationJump to search
m (→‎Syntax: swap to JavaScript syntax for return type)
m (marking core sample code vs other sample code.)
Line 39: Line 39:


== Examples ==
== Examples ==
<code><pre>
{{Core samp |1=<pre style="border: none; margin: inherit;">
GM_log("Hello, World!");
GM_log("Hello, World!");
</pre></code>
</pre>}}


<code><pre>
{{Core samp |1=<pre style="border: none; margin: inherit;">
GM_log("Warning, " + someInputField.value + "!");
GM_log("Warning, " + someInputField.value + "!");
</pre></code>
</pre>}}


[[#top|top]]
[[#top|top]]

Revision as of 23:48, 6 May 2009

Template:Underscore

Book.png
Greasemonkey Manual
Using Greasemonkey
Installing Scripts
Monkey Menu
Getting Help
User Script Authoring
Editing
Environment
API

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: undefined
Compatibility: Greasemonkey 0.3b+
Parameters
Properties
message
  • All properties are optional except message.

top

Properties


message

Value: String, Integer[1] or Boolean[1]
Usage: message = "ARGHHH!";
  • Message to send to the JavaScript error console.
  • [1] While the value may be a non-string, it will convert the argument to a string. There may also be some instances of visual clipping on large numerical values during conversion. This is a feature present in Mozilla based JavaScript console logging.

top | back

Examples

Template:Core samp

Template:Core samp

top

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.

top

Notes

top