Skip to content
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

Wrap stderr in a structure log delegator #564

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Jan 28, 2025

After #559, the server and its add-ons can send notifications, but regular puts that would normally be redirected to stderr are now lost.

Trying to account for any type of print in the notifier thread would be difficult. We need to be able to match against the \r\n\r\n separator, so that we can know exactly the start and end of a structured message.

So I propose we wrap stderr in a delegator instead. Essentially, any method invoked on stderr will still be redirect to it, but it gives us an opportunity to override puts and print to use structured logging, instead of just writing the strings directly to the pipe.

I tested this with the Tapioca add-on and I'm able to accurately see both progress notifications and messages in the output tab.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock added the enhancement New feature or request label Jan 28, 2025 — with Graphite App
@vinistock vinistock self-assigned this Jan 28, 2025
@vinistock vinistock requested review from andyw8 and KaanOzkan January 28, 2025 20:38
@vinistock vinistock marked this pull request as ready for review January 28, 2025 20:41
@vinistock vinistock requested a review from a team as a code owner January 28, 2025 20:41
@andyw8
Copy link
Contributor

andyw8 commented Jan 28, 2025

Seeing some intermittent test failures in CI.

@vinistock vinistock force-pushed the 01-28-wrap_stderr_in_a_structure_log_delegator branch from 7e0c796 to ae58226 Compare January 28, 2025 21:13
@vinistock vinistock merged commit 99dace1 into main Jan 29, 2025
29 checks passed
@vinistock vinistock deleted the 01-28-wrap_stderr_in_a_structure_log_delegator branch January 29, 2025 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants