feat: add structured Pino logging to bridge-starter-node#1150
Merged
sublime247 merged 3 commits intoMay 30, 2026
Merged
Conversation
Replaces all console.log/warn/error calls with a unified Pino logger
so every log line is a structured JSON object that log aggregators
(Loki, Datadog, CloudWatch, ELK) can parse without transformation.
## Changes
bridge-starter-node/src/logger.ts (new)
- Central Pino logger instance shared across the entire template
- base fields: service='bridge-starter-node', env=NODE_ENV
- formatters.level: emits uppercase label (INFO, WARN, ERROR, DEBUG)
- timestamp: ISO-8601 via pino.stdTimeFunctions.isoTime
- redact: authorization, apiKey, secret, password, token paths
replaced with [REDACTED] before any transport sees them
- Transport: raw JSON to stdout in production/CI; pino-pretty
coloured output in development (NODE_ENV=development or LOG_PRETTY=true)
- LOG_LEVEL env var controls verbosity (default: 'info')
- Exports childLogger() helper for request-scoped bindings
bridge-starter-node/src/app.ts
- Replace console.log server-start message with logger.info({ port })
- Add HTTP request/response logging middleware: logs method, path,
statusCode, durationMs, requestId on every response finish event
- Level is auto-selected: error (5xx), warn (4xx), info (2xx/3xx)
bridge-starter-node/src/middleware/verifySignature.ts
- Replace res.status(401) bare return with explicit void return type
- Add missing-signature guard with logger.warn structured log
- Replace console-based invalid-signature log with logger.warn
- Use crypto.timingSafeEqual to prevent timing-oracle attacks
bridge-starter-node/src/routes/webhook.ts
- Replace console.log('Received webhook') with logger.info({ eventType })
- payment.success: logger.info with paymentId, amount, status fields
- payment.failed: logger.warn with paymentId, amount, status fields
- default: logger.warn({ eventType }) for unhandled event types
bridge-starter-node/src/services/bridge.ts
- Add logger.debug before outbound request (amount, currency)
- Add logger.info on success (paymentId, status, amount, currency)
- Replace console.error with logger.error({ err.message, err.status,
responseData }) — Authorization header is redacted automatically
bridge-starter-node/package.json
- Add pino@^9.7.0 and pino-pretty@^13.0.0 as runtime dependencies
…Signature main renamed the middleware export from verifySignature to verifyWebhookSignature and removed the explicit :void return type annotation on the route handler callback. Applied both main changes while preserving all pino structured logging added in this branch: - middleware/verifySignature.ts: export renamed to verifyWebhookSignature - routes/webhook.ts: import and usage updated to verifyWebhookSignature, route handler return type annotation removed to match main
|
@aliyuHabibu Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces all console.log/warn/error calls with a unified Pino logger so every log line is a structured JSON object that log aggregators (Loki, Datadog, CloudWatch, ELK) can parse without transformation.
Changes
bridge-starter-node/src/logger.ts (new)
bridge-starter-node/src/app.ts
bridge-starter-node/src/middleware/verifySignature.ts
bridge-starter-node/src/routes/webhook.ts
bridge-starter-node/src/services/bridge.ts
bridge-starter-node/package.json
Closes #997