GM log: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
No edit summary
(Removed level argument - apparently not supported, see discussion.)
Line 3: Line 3:
= Syntax =
= Syntax =


'''GM_log(''' ''message'', ''level'' ''')'''
'''GM_log(''' ''message'' ''')'''


= Description =
= Description =
Line 11: Line 11:


The ''message'' string is required.
The ''message'' string is required.
The ''level'' is optional and defaults to 0.
Valid values are:
; 0 : info
; 1 : warning
; 2 : error


= Examples =
= Examples =


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


= Notes =
= Notes =

Revision as of 00:14, 20 March 2007

Template:Underscore

Syntax

GM_log( message )

Description

Allows script authors simple access to logging informational messages in the Error Console. This can be helpful for debugging.

The message string is required.

Examples

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

Notes

GM_log is available in Greasemonkey version 0.3 and later.

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.