-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ruff server
: Tracing system now respects log level and trace level, with options to log to a file
#11747
Conversation
fd31d96
to
511a19b
Compare
|
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
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! |
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.
logLevel
setting has been added, which lets a user set the log level. By default, it is set to"info"
.logFile
setting 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
.$/setTrace
handler 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_TRACE
can override the trace level.tracing-tree
, and instead usetracing_subscriber::fmt::Layer
to 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.server
set to its default value, no logs from Ruff should appear.After changing
ruff.trace.server
to eithermessages
orverbose
, you should see log messages atinfo
level 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
info
level or higher should be visible in Helix:You can use
:log-open
to 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
:LspLog
that look like the following:You can adjust
logLevel
andlogFile
insettings
:The
logLevel
andlogFile
can 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: