Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igrek8/trace-nestjs
Adds x-response-id header with uuid
https://github.com/igrek8/trace-nestjs
logging nest nestjs
Last synced: about 2 months ago
JSON representation
Adds x-response-id header with uuid
- Host: GitHub
- URL: https://github.com/igrek8/trace-nestjs
- Owner: igrek8
- License: mit
- Created: 2022-10-16T06:22:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-15T19:17:13.000Z (2 months ago)
- Last Synced: 2024-11-16T01:33:04.071Z (2 months ago)
- Topics: logging, nest, nestjs
- Language: TypeScript
- Homepage:
- Size: 1.84 MB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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`](https://github.com/igrek8/gc-json-logger-nestjs).
[![NPM](https://badgen.net/npm/v/trace-nestjs)](https://www.npmjs.com/trace-nestjs)
[![Coverage](https://codecov.io/gh/igrek8/trace-nestjs/branch/main/graph/badge.svg)](https://codecov.io/gh/igrek8/trace-nestjs)
![Release](https://badgen.net/github/checks/igrek8/trace-nestjs)
![License](https://badgen.net/github/license/igrek8/trace-nestjs)## Installation
```bash
npm install --save \
gc-json-logger \
gc-json-logger-nestjs \
trace-nestjsyarn add \
gc-json-logger \
gc-json-logger-nestjs \
trace-nestjs
```## OpenAPI
![Swagger](./media/swagger.png)
## Usage
[Example](./src/demo/main.ts)
```jsonc
/* 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"}}
```