2.2.0 • Published 3 years ago
gc-json-logger-nestjs v2.2.0
Logger for Structured Logging with Asynchronous Context Tracking (Stability: 2 - Stable) to log HTTP traffic in Nest.JS (Express.JS) in GKE
Enables structured logging for Nest.js application running in Google Cloud platform.
Installation
npm install --save \
gc-json-logger \
gc-json-logger-express \
gc-json-logger-nestjs
yarn add \
gc-json-logger \
gc-json-logger-express \
gc-json-logger-nestjsView in Google Cloud Monitoring

Usage
Demo
Shell
git clone https://github.com/igrek8/gc-json-logger-nestjs
cd gc-json-logger-nestjs
npm install
npm run devLog Structure
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"Starting Nest application...","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"NestFactory"}}
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"LoggerModule dependencies initialized","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"InstanceLoader"}}
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"AppModule dependencies initialized","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"InstanceLoader"}}
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"AppController {/}:","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"RoutesResolver"}}
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"Mapped {/trace, POST} route","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"RouterExplorer"}}
{"severity":"INFO","time":"2022-10-08T00:00:00.000Z","message":"Nest application successfully started","logging.googleapis.com/operation":{"id":"app"},"meta":{"context":"NestApplication"}}
/* HTTP log and LoggerService use the same UUID in "logging.googleapis.com/operation" */Use with jq
node ./server.js | jq -r '."logging.googleapis.com/operation".id as $id | { time, severity, $id, message } | join(" ")'Trace Request-Response cycle
Trace-NestJS module adds X-Request-ID and X-Response-ID headers that match operation id.
1.5.0
3 years ago
2.2.0
3 years ago
2.1.0
3 years ago
2.0.0
3 years ago
1.4.0
3 years ago
1.2.0
3 years ago
1.3.0
3 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.10
4 years ago
0.0.11
4 years ago
0.0.12
4 years ago
0.0.13
4 years ago
0.0.14
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.1
4 years ago