上QQ阅读APP看书,第一时间看更新
There's more...
If you want to experiment, start your configurable middleware test application with the enable property set to false. No logs should be displayed.
Usually, you would want to disable logging in production, since this operation could hit performance.
An alternative to disabling all logging is to use other libraries to do this task instead of using console. There are libraries that allow you to set different levels of logging as well, for instance:
- Debug module: https://www.npmjs.com/package/debug
- Winston: https://www.npmjs.com/package/winston
Logging is useful for several reasons. The main reasons are:
- It checks whether your services are running properly, for example, checking whether your application is connected to MongoDB.
- It discovers errors and bugs.
- It helps you to understand better how your application is working. For instance, if you have a modular application, you can see how it integrates when included in other applications.