Skip to content

Integrate Winston Structured Logging Middleware to Record Method, Path, Status, and Duration per Request #227

@mftee

Description

@mftee

Description:
Add structured request/response logging using Winston as an independent middleware layer, so every inbound HTTP request is logged with method, path, status code, and duration.

Tasks:

  • Install winston and nest-winston
  • Create src/common/middleware/logger.middleware.ts implementing NestMiddleware
  • Log: method, url, status, duration_ms, user_agent, ip
  • Apply the middleware globally in AppModule
  • Replace default NestJS logger with Winston logger in main.ts
  • Add LOG_LEVEL env var (debug, info, warn, error) to .env.example

Acceptance Criteria:

  • Every request produces a structured log line in JSON format
  • Log level is configurable via env var
  • Sensitive headers (Authorization) are redacted from logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions