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

Add logLevel and logFile extension setting #530

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Conversation

dhruvmanila
Copy link
Member

Summary

This PR adds ruff.logLevel and ruff.logFile settings to the VS Code extension which corresponds to the same for the ruff server. Without these, there's no way to configure the log level and the destination for the log messages unlike other editors.

Test Plan

Using the following config:

{
  "ruff.logLevel": "debug",
  "ruff.logFile": "~/playground/ruff/server.logs",
  "ruff.trace.server": "messages"
}

I confirmed that it outputs the logs messages at the specified location.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

What's the relationship of the new logLevel setting to the tracing setting?

@dhruvmanila
Copy link
Member Author

What's the relationship of the new logLevel setting to the tracing setting?

The ruff.server.trace value is either off | messages | verbose where

  • off doesn't emit any log messages
  • messages will only emit the type of request and response along with Ruff server's log messages but only at INFO or above
  • verbose will emit the request and response parameters as well

Ruff server also emits trace messages at different levels, specifically DEBUG level but there's no way to update that from VS Code. This is different in other editors where a user can update the logLevel server setting.

Only updating the logLevel doesn't make any difference, it should be combined with updating the ruff.server.trace to messages or verbose for Ruff to emit the messages at the specified logLevel.

Comment on lines 133 to 137
let logFile = config.get<string>("logFile");
if (logFile !== undefined) {
logFile = resolveVariables(logFile, workspace);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, this is incorrect. It seems that the logLevel and logFile settings in the server code is only taken from the global settings i.e., they aren't resolve per workspace which makes sense. So, we can't allow VS Code variables in here. I'll revert this.

@dhruvmanila dhruvmanila merged commit b96df5c into main Jul 16, 2024
6 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/log-level branch July 16, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants