DEV Community

Discussion on: why you should not use console.log( ) for debugging ?

Collapse
 
vit100 profile image
Vitaliy Markitanov • Edited

'''Why not just use the debugger available in most IDE's and text editors?'''

Because 'debug' can be used not only during debugging in IDE, but on servers, where you don't have IDE.

Collapse
 
lewiskori profile image
Lewis kori

Well that's true. I haven't encountered a scenario where I print variables in production servers. But I do see your point.

There's a comment here on pino-logger with sentry. Granted, sentry isn't a one size fits all, but I would use this in a server for logging.

an even better option is you use pino-logger, it has methods like logger.error, logger.info etc and you can send those logs to be collected somewhere like a file or even a third party service like sentry. I dont recommend using the debug module like this when loggers exist