O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Log levels and logging mechanisms 

Based on different aspects of an application, we need different log levels in our code, along with enough logging statements in code. We will use winston (https://www.npmjs.com/package/winston), which will have the ability to change log level dynamically. Furthermore, we will use async log appenders so that our thread won't be blocked by log requests. We will leverage Async Hooks (https://nodejs.org/api/async_hooks.html), which will help us track the life cycle of resources during our process. An Async Hook enables us to tap any life cycle events by registering callbacks to any life cycle events. At resource initialization, we get a unique identifier ID (asyncId) and parent identifier ID (triggerAsyncId ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required