Why not just use the debugger available in most IDE's and text editors?
They offer a ton of benefits such as breakpoints etc
Also in case you are using vscode, the turbo console log extension helps in managing the log statements and you can easily remove all the log statements with one command.
Yes, that looks handy. When you are a developer, there might be couple of situations where you work with terminal based editors or IDEs without plug-ins for debugging.
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
Just let people debug their programs the way they like it. It is a misconception that IDE debuggers are the best debugging tool - the best debugging tool is the one you know best. If you feel comfortable with console.log, just use that.
I think one of the biggest arguments to make here is that almost all modern consumption of logging is done in a cloud interface which is expecting a formatted object. By utilizing console.log, most time people aren't stringifying the data, and just using the strings.
It creates clutter and future technical debt when you've ran up 2000 dollars in logging fees on a lambda service.
Why not just use the debugger available in most IDE's and text editors?
They offer a ton of benefits such as breakpoints etc
Also in case you are using vscode, the turbo console log extension helps in managing the log statements and you can easily remove all the log statements with one command.
Yes, that looks handy. When you are a developer, there might be couple of situations where you work with terminal based editors or IDEs without plug-ins for debugging.
absolutely. Thanks for the write up.
excellent work.
Besides breakpoints, a lot of tools offer Logpoints or Tracepoints. They do not break execution but only output the contents of a variable.
'''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.
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
Just let people debug their programs the way they like it. It is a misconception that IDE debuggers are the best debugging tool - the best debugging tool is the one you know best. If you feel comfortable with
console.log
, just use that.I think one of the biggest arguments to make here is that almost all modern consumption of logging is done in a cloud interface which is expecting a formatted object. By utilizing console.log, most time people aren't stringifying the data, and just using the strings.
It creates clutter and future technical debt when you've ran up 2000 dollars in logging fees on a lambda service.
Not a critique, just food for thought.
I never get them to work properly. They always randomly stop working.
The debugger or turbo console log?
The problem I find with debugging is sometimes the breakpoints dont work with async functions. Debugger statement helps, but not that handy.