I wrote a simple console stub to make it easier to develop on multiple 
browsers, and enable/disable console quickly.

The attached script will create a JSConsole object which bears all the 
functions supported by Firebug. If you use the JSConsole object in your 
code as it was the Firebug console, your code should continue working on 
all browsers, whether or not they have consoles. The JSConsole will try 
to use the native console function if available, or will use console.log 
if the called function isn't there.

By simply switching EnableConsole to false, the JSConsole object will 
become inert, still supporting all functions, but not producing any result.

Code can be used, modified, redistributed under a BSD-style license, as 
Firebug.

It could be seen like a Firebug-lite-lite :-)

NH

Mike Ratcliffe wrote:
> Actually IE8 Developer Tools (F12) does display console.log messages
> in it's console ... console.dir etc. does not work though.
>
> On Jul 29, 11:38 pm, YaoXing Zhang <[email protected]> wrote:
>   
>> Yes it will. And IE users don't have console object at all.
>> As long as JavsScript doesn't have conditional compilation like other
>> languages, I prefer defining a flag
>> var DEBUG = true;
>> if (DEBUG) console.log(...);
>>
>> Regards,
>> YX
>>
>> On 2009/7/29 15:56, Laurakeet wrote:
>>
>>     
>>> If I am using console.log for debugging locally do I need to make sure
>>> I remove those statements once I have pushed my code to a live web
>>> page? What if random users don't have firebug? Will it break my forms
>>> or other pages?
>>>       
>>> thanks,
>>> Laura
>>>       


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: consolestub.js
Description: JavaScript source

Reply via email to