DEV Community

Discussion on: Better console.logs

Collapse
 
tetri profile image
Tetri Mesquita • Edited

All this methods to debug operations could be seen by final users when console is open in released applications.

I use console.debug with all included arguments and the debug messages only appears when application is in debug mode and the level of messages from console includes Verbose messages.

Collapse
 
wangonya profile image
Kelvin Wangonya

Hey Tetri. You're right. These methods are just used in development for debugging and should be omitted in production code to avoid maybe giving out information that shouldn't get to the end user. I should have mentioned that.

Your method is definitely better :)

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

I wasn't sure where to stick this comment. One of my favorite things to do when I visit a new tech website is to check the developer console for hidden messages. Looking at you, Reddit.

Thread Thread
 
wangonya profile image
Kelvin Wangonya

Nice idea! I'm actually working on a redesign of my site. I'll make sure to add something fun in the console for anyone looking around :)

Thread Thread
 
dirtycode1337 profile image
Dirty-Co.de

I do this all the time when surfing through the web, open console, viewing source code, finding curious things - like job offers - which seems to be one of the best placement for web development job offers :). I made a small (totally incomplete) article series (in German) out of it: dirty-co.de/category/jobanzeigen-i... ;)

Collapse
 
david_j_eddy profile image
David J Eddy

While I do agree using console.log() would present information to the user via the client console once the code has reached the client, it's all accessible anyways. Security through obscurity is not security. Adding breakpoints and tracing code execution in the client is trivial now days.