Skip to content

refactor: implement comprehensive logging standards (#536)#577

Open
Muyideen-js wants to merge 1 commit into
rinafcode:mainfrom
Muyideen-js:muyideen-js-logging
Open

refactor: implement comprehensive logging standards (#536)#577
Muyideen-js wants to merge 1 commit into
rinafcode:mainfrom
Muyideen-js:muyideen-js-logging

Conversation

@Muyideen-js
Copy link
Copy Markdown
Contributor

@Muyideen-js Muyideen-js commented May 29, 2026

Closes rinafcode/teachLink_backend#536

Overview

This PR implements comprehensive, standardized, and secure logging across the application, addressing all criteria outlined in issue 536

Changes Made

  • Structured Logging (Pino): Standardized all logs as machine-indexable JSON records with distinct log levels (debug, info, warn, error).
  • Correlation ID Auto-Propagation: Integrated Node's native AsyncLocalStorage (runWithLogContext) to automatically pass and correlate requestId and correlationId across asynchronous chains. Fallback IDs are automatically generated if context is missing.
  • Sensitive Data Redaction (PII/Secrets): Engineered a robust dual redaction system:
    • Configured built-in Pino redaction settings for standard output streams.
    • Implemented a recursive deep-redaction utility that replaces sensitive values matching keys like password, secret, token, key, authorization, email, phone, ssn, auth, bearer with [REDACTED] before writing to any custom transports (like Http or In-Memory stores).
    • Standardized automated Bearer token regex-based redaction in log messages.
  • Middleware integration: Wrapped request executions in runWithLogContext within withRequestLogging to correlate all request-lifecycle operations automatically.
  • Standards Documentation: Created a detailed logging guide in src/lib/logging/README.md covering standards, log levels, configurations, and best practices.

Verification

  • Added 3 new unit tests to logger.test.ts covering redaction, AsyncLocalStorage context propagation, and fallback ID generation.
  • All 5 logging service tests and all 6 wallet connection unit tests pass successfully.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

Hey @Muyideen-js! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#503 refactor Wallet Connection : Bug Fix (Issue 105) Link to this issue

ℹ️ Learn more about linking PRs to issues

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

Kindly resolve conflict and fix workflow.

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.

Implement comprehensive logging standards

2 participants