Cls Rtracer

screenshot of Cls Rtracer
express

Request Tracer - CLS-based request id generation for Express, Fastify, Koa and Hapi, batteries included

Overview:

cls-rtracer is a middleware and plugin library designed for Express, Koa, Fastify, and Hapi to facilitate CLS-based request id generation for logging purposes. The library automatically generates a UUID V1 value as the request id, but can also use the X-Request-Id header value if provided. It is compatible with Express v4, Fastify v2 and v3, Koa v1 and v2, and Hapi v18, requiring Node.js 12.17.0+ for version 2 and Node.js 8.0+ for version 1.

Features:

  • Request Tracer Middleware/Plugin: Generates and stores a UUID V1 value as the request id for each request.
  • Compatibility: Works with Express v4, Fastify v2 and v3, Koa v1 and v2, and Hapi v18.
  • Integration with Loggers: Streamlines request id generation and logging across applications.
  • Support for AsyncLocalStorage: Utilizes CLS core API for maintaining request id across asynchronous operations.

Summary:

cls-rtracer is a versatile middleware and plugin library that simplifies request id generation and logging for Express, Koa, Fastify, and Hapi applications. By automatically generating UUID V1 request ids and integrating with existing loggers, cls-rtracer offers a comprehensive solution for tracking requests across various platforms. With support for AsyncLocalStorage and compatibility with different Node.js versions, it provides a reliable and efficient method for enhancing log correlation within applications.

express
Express

Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.