-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ruff server: Tracing system now respects log level and trace level, with options to log to a file
#11747
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
Conversation
fd31d96 to
511a19b
Compare
|
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think we should address the TODO before merging this and extend the test plan with a case that shows that changing the verbosity in the extension settings changes the output.
CodSpeed Performance ReportMerging #11747 will improve performances by 13.17%Comparing Summary
Benchmarks breakdown
|
ruff server: Use window/logMessage for tracing eventsruff server: Tracing system now respects log level and trace level, with options to log to a file
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look good to me. I left a few questions and are waiting for a test plan that shows a few traces.
I think some documentation on how the tracing setup would be helpful, especially because it now supports environment variables, tracing level, logLevel, log file etc.
|
This looks good to me. Happy to approve tomorrow morning when the Test plan's filled out. Thanks for doing another iteration on this! |
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank's for taking the time to iterate on the design
|
This isn't blocking the PR but can you provide similar examples for Neovim. I'm able to set the |
|
@dhruvmanila I've updated the PR description with a Neovim testing guide 😄 |
A follow-up to [this suggestion](#11747 (comment)) on the tracing PR.
A follow-up to [this suggestion](#11747 (comment)) on the tracing PR. --------- Co-authored-by: Dhruv Manilawala <[email protected]>
Summary
Fixes #10968.
Fixes #11545.
The server's tracing system has been rewritten from the ground up. The server now has trace level and log level settings which restrict the tracing events and spans that get logged.
logLevelsetting has been added, which lets a user set the log level. By default, it is set to"info".logFilesetting has also been added, which lets the user supply an optional file to send tracing output (it does not have to exist as a file yet). By default, if this is unset, tracing output will be sent tostderr.$/setTracehandler has also been added, and we also set the trace level from the initialization options. For editors without direct support for tracing, the environment variableRUFF_TRACEcan override the trace level.tracing-tree, and instead usetracing_subscriber::fmt::Layerto format output. Thread names are now included in traces, and I've made some adjustment to thread worker names to be more useful.Test Plan
In VS Code, with
ruff.trace.serverset to its default value, no logs from Ruff should appear.After changing

ruff.trace.serverto eithermessagesorverbose, you should see log messages atinfolevel or higher appear in Ruff's output:In Helix, by default, no logs from Ruff should appear.
To set the trace level in Helix, you'll need to modify your language configuration as follows:
After doing this, logs of

infolevel or higher should be visible in Helix:You can use
:log-opento quickly open the Helix log file.In Neovim, by default, no logs from Ruff should appear.
To set the trace level in Neovim, you'll need to modify your configuration as follows:
You should see logs appear in

:LspLogthat look like the following:You can adjust
logLevelandlogFileinsettings:The
logLevelandlogFilecan also be set in Helix like so:Even if this log file does not exist, it should now be created and written to after running the server: