-
Notifications
You must be signed in to change notification settings - Fork 38
Replace console.log with structured logging using Winston or Pino #161
Copy link
Copy link
Closed
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbackendBackend related issuesBackend related issuesdifficulty:hardHard difficulty issuesHard difficulty issuesobservabilityLogging, monitoring, tracingLogging, monitoring, tracingpriority:highHigh priority issuesHigh priority issues
Description
Activity
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbackendBackend related issuesBackend related issuesdifficulty:hardHard difficulty issuesHard difficulty issuesobservabilityLogging, monitoring, tracingLogging, monitoring, tracingpriority:highHigh priority issuesHigh priority issues
What
Replace all
console.logandconsole.errorcalls in the backend with structured logging using Pino (or Winston). Add log levels, JSON output format, request context (request ID, user ID), and correlation IDs for tracing requests across services.Why
The backend currently uses
console.logfor logging (visible inmain.tsand likely scattered across services). For a health credential platform in production, this is insufficient:SECURITY.md mentions Sentry and Datadog integration — structured logging is the prerequisite for both.
Scope
In scope:
nestjs-pino(ornest-winston) and configure as the NestJS loggerconsole.log/console.errorcalls with proper logger methodsLOG_LEVELenv var to.env.exampleOut of scope:
backend/src/audit/)Acceptance Criteria
nestjs-pino(ornest-winston) is installed and configuredconsole.logandconsole.errorcalls inbackend/src/are replacedLOG_LEVELenv var controls minimum log levelnpm run start:devshows colored, readable logsnpm run start:prodoutputs JSON logsTechnical Context
backend/src/main.ts— replaceLoggerusagenestjs-pinois the most popular NestJS logging integration: https://github.com/iamolegga/nestjs-pinopino-httpmiddleware for automatic request loggingnestjs-pino'sreq.idorX-Request-Idheaderpino'sredactoption for sensitive fields