Skip to content

feat: integrate structured JSON logging with nestjs-pino#446

Merged
Devsol-01 merged 1 commit intoDevsol-01:mainfrom
daveades:feat/structured-logging-nestjs-pino
Mar 27, 2026
Merged

feat: integrate structured JSON logging with nestjs-pino#446
Devsol-01 merged 1 commit intoDevsol-01:mainfrom
daveades:feat/structured-logging-nestjs-pino

Conversation

@daveades
Copy link
Copy Markdown
Contributor

Summary

  • Installs nestjs-pino, pino-http, and pino-pretty (dev dependency)
  • Configures LoggerModule globally in AppModule using forRootAsync — reads NODE_ENV to switch between pretty-printed (development) and raw JSON (production) output
  • Replaces the default NestJS logger in main.ts with the Pino logger via bufferLogs: true + app.useLogger(app.get(Logger))
  • Replaces console.log startup messages with structured logger calls

Closes #123

Test plan

  • Run locally with NODE_ENV=development — logs should be pretty-printed via pino-pretty
  • Run with NODE_ENV=production — logs should be raw JSON (suitable for Datadog/ELK ingestion)
  • Confirm HTTP request logs appear via pino-http middleware
  • Confirm NestJS bootstrap log messages appear through the Pino logger

- Install nestjs-pino, pino-http, and pino-pretty (dev)
- Configure LoggerModule globally in AppModule with async factory
  that reads NODE_ENV: pretty-printed in development, raw JSON in production
- Replace default NestJS logger in main.ts with Pino logger using
  bufferLogs and app.useLogger(app.get(Logger)) pattern
- Replace console.log startup messages with structured logger calls

Closes Devsol-01#123
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nestera Ready Ready Preview, Comment Mar 27, 2026 2:24pm

@Devsol-01 Devsol-01 merged commit 9453ce4 into Devsol-01:main Mar 27, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate Structured Logging

2 participants