Skip to content

Feat/structured json logging#194

Open
whitezaddy wants to merge 3 commits into
BETAIL-BOYS:mainfrom
whitezaddy:feat/structured-json-logging
Open

Feat/structured json logging#194
whitezaddy wants to merge 3 commits into
BETAIL-BOYS:mainfrom
whitezaddy:feat/structured-json-logging

Conversation

@whitezaddy

Copy link
Copy Markdown

Pull Request: Refactor Global Logging Architecture to Structured Flat JSON

Closes #176

🚀 Overview

This pull request refactors the API's global logging architecture to output strictly formatted JSON strings instead of raw human-readable console text. This prepares the application environment for high-scale log ingestion, filtering, and metric query aggregation across centralized observability tools like AWS CloudWatch or the ELK stack.

🛠️ Key Changes

  • Pino Integration: Integrated nestjs-pino and pino-http as the primary global application log interceptors inside src/app.module.ts and src/main.ts.
  • Correlation ID Mapping: Added automatic tracking context matching that extracts the X-Request-ID header value directly into the top-level "reqId" attribute field across all nested HTTP lifecycle access logs.
  • Telemetry Standardization: Migrated legacy unmanaged print methods inside the background indexer engine (src/jobs/indexer.ts) to use Nest's structured logger utility framework.
  • Resiliency Fallbacks: Configured local ioredis option constraints (retryStrategy: null) to prevent unhandled background execution termination loops when testing telemetry behavior in offline decoupled infrastructure scenarios.

🧪 Verification & Testing

The application dev pipeline was run locally and verified to stream fully conformant flat telemetry objects.

Example Standardized Standard Out Stream Lines:

{"level":"info","time":"2026-06-29T14:41:55.160Z","pid":18064,"hostname":"WHITE-DESKTOP-T9M3C0D","context":"Bootstrap","msg":"Application is running on: http://localhost:3000"}
{"level":"warn","time":"2026-06-29T14:56:55.161Z","pid":18064,"hostname":"WHITE-DESKTOP-T9M3C0D","context":"RedisService","msg":"Redis tracking network offline (Host: localhost:6379). Bypassing telemetry streaming metrics locally."}

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.

[DevOps] Centralized Structured JSON Logging Implementation

1 participant