Repository navigation
fix: send server logs as JSONRPC log notifications (Fixes #571) - #582
Open
Luca Zani (OverloadedTech) wants to merge 2 commits into
Open
Luca Zani (OverloadedTech) wants to merge 2 commits into
Luca Zani (OverloadedTech) wants to merge 2 commits into
Conversation
Since microsoft#314, `pet server` wrote tracing output to stderr with ANSI colors instead of sending `log` notifications, so the Python Environments extension showed every warning as an [error] line full of escape codes. The CLI also kept the colors when stderr was redirected to a file.
Author
|
@microsoft-github-policy-service agree |
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.
Since #314
pet serveruses the same stderr tracing setup aspet find, so warnings and errors go to stderr with ANSI colors instead of being sent aslognotifications (docs/JSONRPC.md). The extension logs stderr as errors, hence the[error] [pet] ␛[33m WARN␛[0mlines in #571.This adds a small tracing layer for server mode that sends each event as a
lognotification with its level. The filter is the same as before (warnby default,RUST_LOGto change it), and trace maps to debug like the oldinitialize_loggerdid. The CLI now only uses colors when stderr is a terminal.The raw RPC test client skips
lognotifications inreceive(), since a few existing tests trigger errors and would otherwise get the notification before the reply.PET_TRACE_FORMAT=jsonno longer does anything in server mode. I couldn't find anything using it there, but I can keep a stderr layer for it if you rely on it.Tested on macOS: the new tests fail on main and pass here,
cargo testandscripts/rust-precommit.share clean, and I checked the server output andpet find 2> err.txtby hand. Haven't tried Windows or the extension.Fixes #571