FireBug Logging Function

By Richard Davies Last update Apr 28, 2006 — Installed 452 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 3, 0
// FireBug printfire() JavaScript logging function
// v1.0 2006-04-21
// Greasemonkey script created by Richard Davies (Richard [at] richarddavies [dot] us)
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey:http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "FireBug Logging Function", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name           FireBug Logging Function
// @description    Adds printfire() function to enable writing logging info to the FireBug JS console
// @include        *
// ==/UserScript==

var printfire = document.createElement("script");
printfire.type = "text/javascript";
printfire.innerHTML = 'function printfire() { if (document.createEvent) { printfire.args = arguments; var ev = document.createEvent("Events"); ev.initEvent("printfire", false, true); dispatchEvent(ev); } } ';

var head = document.getElementsByTagName("head");
head[0].appendChild(printfire);