aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes questions about  console.info() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "questions about  console.info() " Watch "questions about  console.info() " New topic
Author

questions about console.info()

Chrix Wu
Ranch Hand

Joined: Nov 15, 2009
Posts: 121
I am using "console.info()" together with firefox firebug to debug js code,

i have following question:

can i leave all these console debugging code in the js file, and if my client is using IE, what will happen? is that going to produce any unhappy outcomes?

in other words, Is "console.info()" for firefox/firebug only, or it is a js built in function?


** SCJP 5.0 84% **
** SCWCD 1.5 76% **
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

The console methods are supported by a wide range of browsers, but will cause problems if the browser does not support then or if debugging is turned off. Besides, do your customers really want to see your debugging messages on their consoles?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Chrix Wu
Ranch Hand

Joined: Nov 15, 2009
Posts: 121
Bear Bibeault wrote:The console methods are supported by a wide range of browsers, but will cause problems if the browser does not support then or if debugging is turned off. Besides, do your customers really want to see your debugging messages on their consoles?



hi bear,

I dont know whether my client likes it or not.

my question is, how do you handle all these console debugging codes? we need to remove it one by one when the code is committed?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

Personally, I remove them before a build.

Another tactic I've seen is to create your own wrapper method that does nothing if the symbol console is undefined, and performs logging if it is.
Chrix Wu
Ranch Hand

Joined: Nov 15, 2009
Posts: 121
Bear Bibeault wrote:Personally, I remove them before a build.

Another tactic I've seen is to create your own wrapper method that does nothing if the symbol console is undefined, and performs logging if it is.


thanks for your suggestion!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
Better to remove them, nothing like leaving code in your application that does nothing. Milliseconds add up.

Eric
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: questions about console.info()
 
Similar Threads
Page submission on change of drop down value not working
How to debug an Android web app
Why is Servlet Called Twice
Console.info equivalent in IE
Problem with dojo.io.bind