Skip to content

fix(logger): replace PassThrough with Writable for log handling COMPASS-9736 #7222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nbbeeken
Copy link
Contributor

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the fix label Aug 22, 2025
@nbbeeken nbbeeken added the no release notes Fix or feature not for release notes label Aug 22, 2025
@nbbeeken nbbeeken marked this pull request as ready for review August 22, 2025 18:05
@Copilot Copilot AI review requested due to automatic review settings August 22, 2025 18:05
@nbbeeken nbbeeken requested a review from a team as a code owner August 22, 2025 18:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors the logger implementation to replace PassThrough stream with a custom Writable stream object for better control over log handling in the CompassWebLogger class.

  • Replaces PassThrough stream with a custom Writable-like object that directly handles write and end operations
  • Simplifies the logging pipeline by removing intermediate stream handling
  • Maintains the same callback functionality for log processing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nbbeeken nbbeeken requested a review from syn-zhu August 22, 2025 18:07
});
const target = {
write(line: string, callback: () => void) {
callbackRef.current.onLog?.(JSON.parse(line));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to update the test ensure it's happening synchronously?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants