GM log: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Jerone (talk | contribs)
Marti (talk | contribs)
m →‎<code>message</code>: Good catch Jerone! Also read the notation about clipping (e.g. rounding/truncating)
Line 30: Line 30:
----
----
==== <code>message</code> ====
==== <code>message</code> ====
:Value: String, Integer or Boolean
:Value: String, Integer<sup>[1]</sup> or Boolean<sup>[1]</sup>
:Usage: <code>'''message''' = "ARGHHH!";</code>
:Usage: <code>'''message''' = "ARGHHH!";</code>


:* Message to send to the JavaScript error console.
:* Message to send to the JavaScript error console.
 
:* <sup>[1]</sup> 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|top]] | [[#Syntax|back]]''
[[#top|top]] | [[#Syntax|back]]''



Revision as of 21:04, 31 December 2007

Template:Underscore


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.

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

 GM_log("Hello, World!");
GM_log("Warning, " + someInputField.value + "!");

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