[Greasemonkey] GM_log

Mook mook.moz at gmail.com
Fri Jul 1 12:31:49 EDT 2005


On 7/1/05, Shaun Etherton <shaun at synect.com> wrote:
> Hi,
> 
> I have just started looking at greasemonkey so I'm sorry if this is a
> dumb question.
> I was wondering if its possible to use GM_log from within non user.js
> javascript files somehow.
> 
> I have been asked to add some functionality to a complex Javascript
> application and was hoping to use this instead of alerts for debugging.
> 
> cheers,
> --
> Shaun
> 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> 

The other suggestions are good too, but my preferred cheap log is:

function Log(aMessage) {
  setTimeout(function(){throw(aMessage)},0);
}

And then read it in the JS console.  The setTimeout is needed to
prevent the rest of the script from dying.

-- 
Mook
mook.moz at gmail


More information about the Greasemonkey mailing list