GM log: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Marti (talk | contribs)
mNo edit summary
Update for 4.0
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{underscore|title=GM_log}}
As of Greasemonkey 4.0, this method has been removed.  
__NOTOC__
You should use the [https://developer.mozilla.org/en-US/docs/Web/API/console.log console] instead.
 
== 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'' ''')'''
 
: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]].
 
[[#top|top]]
=== Properties ===
----
==== <code>message</code> ====
:Value: String
:Usage: <code>'''message''' = "ARGHHH!";</code>
 
:* Message to send to the JavaScript error console.
 
[[#top|top]] | [[#Syntax|back]]''
 
== Examples ==
<code><pre>
GM_log("Hello, World!");
</pre></code>
 
<code><pre>
GM_log("Warning, " + someInputField.value + "!");
</pre></code>
 
[[#top|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.
 
[[#top|top]]
 
== Notes ==
 
[[#top|top]]
[[Category:API_Reference|G]]

Latest revision as of 15:03, 3 November 2017

As of Greasemonkey 4.0, this method has been removed. You should use the console instead.