| 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
|
|
|
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
|
|
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
|
|
Better to remove them, nothing like leaving code in your application that does nothing. Milliseconds add up.
Eric
|
 |
 |
|
|
subject: questions about console.info()
|
|
|