Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

questions about console.info()

 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better to remove them, nothing like leaving code in your application that does nothing. Milliseconds add up.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic