Skip to content

Adds x-response-id header with uuid

License

Notifications You must be signed in to change notification settings

igrek8/trace-nestjs

Repository files navigation

Trace Nest.js (Express.js) Request-Response Cycle

Adds X-Request-ID and X-Response-ID headers that allow context log entries using gc-json-logger.

NPM Coverage Release License

Installation

npm install --save \
  gc-json-logger \
  gc-json-logger-nestjs \
  trace-nestjs

yarn add \
  gc-json-logger \
  gc-json-logger-nestjs \
  trace-nestjs

OpenAPI

Swagger

Usage

Example

/* reduced logs */
{"message":"POST /","logging.googleapis.com/operation":{"id":"016a575d-39cf-4a3a-b99d-91341c42aa31"}}
{"message":"do work","logging.googleapis.com/operation":{"id":"016a575d-39cf-4a3a-b99d-91341c42aa31"}}
{"message":"201 POST /trace (4ms)","logging.googleapis.com/operation":{"id":"016a575d-39cf-4a3a-b99d-91341c42aa31"}}