Skip to content

Comments

logging functionality added#168

Open
SudiptaPaul-31 wants to merge 1 commit intoDevsol-01:mainfrom
SudiptaPaul-31:feat-logging
Open

logging functionality added#168
SudiptaPaul-31 wants to merge 1 commit intoDevsol-01:mainfrom
SudiptaPaul-31:feat-logging

Conversation

@SudiptaPaul-31
Copy link
Contributor

🚀 Integrate Structured Logging with nestjs-pino

📌 Overview

This PR replaces the default NestJS console logger with structured JSON logging using nestjs-pino.

Structured logging improves observability and enables better log aggregation, searching, and monitoring in production environments using tools like Datadog, ELK Stack, or Grafana.


resolves #123

✅ What’s Included

  • Installed nestjs-pino and pino-http
  • Added pino-pretty for local development
  • Configured LoggerModule globally in AppModule
  • Replaced default NestJS logger in main.ts
  • Enabled:
    • 🧑‍💻 Pretty-printed logs in development
    • 🏭 Raw JSON logs in production
  • Removed console.log usage
  • Enabled bufferLogs to properly initialize logger before app bootstrap

⚙️ Implementation Details

1️⃣ Logger Configuration (AppModule)

  • Used LoggerModule.forRootAsync
  • Dynamically configured log level based on NODE_ENV
  • Enabled pino-pretty transport for non-production environments

2️⃣ Bootstrap Changes (main.ts)

  • Enabled bufferLogs
  • Replaced Nest default logger:
    app.useLogger(app.get(Logger));
  • Logged application startup using structured logger

@vercel
Copy link

vercel bot commented Feb 23, 2026

@SudiptaPaul-31 is attempting to deploy a commit to the devsol-01's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

1 participant