Skip to content

Conversation

BrodyHughes
Copy link
Member

@BrodyHughes BrodyHughes commented Sep 19, 2025

Fixes BX-1931

Adds comprehensive test coverage for the logger system with 39 tests across 3 test files:

What's tested:

  • Core functionality: Log level hierarchy, transport system, metadata handling
  • Error handling: RainbowError integration, error wrapping for non-RainbowError inputs
  • Transports: Console transport formatting and Sentry breadcrumb/exception handling
  • Debug contexts: Wildcard patterns (auth:*) and context-specific filtering
  • Production patterns: Real-world error scenarios from RAPs and analytics
  • Edge cases: Null values, circular references, large objects, transport failures
  • Code quality: Validates no console.log/error in production code (except debug-flagged files)

Key improvements:

  • Tests match actual usage patterns found in codebase
  • Validates both console and Sentry transports work correctly
  • Ensures proper error cause chains are preserved
  • Confirms debug context filtering works as designed

All tests pass and run automatically with yarn test.


PR-Codex overview

This PR focuses on enhancing the logging functionality and validation in the application. It introduces tests to ensure no usage of console.log or console.error in production code and verifies that debug flags are disabled. Additionally, it improves the integration of logging transports.

Detailed summary

  • Added tests in src/logger/console-usage.test.ts to:
    • Ensure console.log and console.error are not used in production code.
    • Validate that debug flags are disabled in specific files.
  • Enhanced src/logger/transports.test.ts to:
    • Test various logging levels in consoleTransport.
    • Verify breadcrumb addition and exception capturing in sentryTransport.
  • Improved src/logger/logger.test.ts to:
    • Validate log level hierarchy and metadata inclusion.
    • Test error handling with cause chains and sensitive data filtering.
    • Ensure correct handling of multiple transports and transport failures.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

linear bot commented Sep 19, 2025

@BrodyHughes BrodyHughes changed the title [WIP] logger tests e2e: Logger Test Suite Enhancement Sep 23, 2025
@BrodyHughes BrodyHughes marked this pull request as ready for review September 23, 2025 18:36
@BrodyHughes BrodyHughes requested a review from janek26 October 7, 2025 15:37
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.

1 participant