I'd like to create a "universal" debug logging function that inspects the JS namespace for well-known logging libraries.
For example, currently it supports Firebug's console.log:
var console = window['console'];
if (console && console.log) {
console.log(message);
}
Obviously, this only works in Firefox if Firebug is installed/enabled (it'll also work on other browsers with Firebug Lite). Basically, I will be providing a JS library which I don't know what environment it will be pulled into, and I'd like to be able to figure out if there is a way to report debug output to the user.
So, perhaps jQuery provides something - I'd check that jQuery is present and use it. Or maybe there are well-known IE plugins that work that I can sniff for. But it has to be a fairly well-established and used mechanism. I can't check for every obscure log function that people create.
Please, only one library/technology per answer, so they can get vote-ranked. Also, using alert() is a good short-term solution but breaks down if you want robust debug logging or if blocking the execution is a problem.