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

Rename razor.trace to razor.server.trace, and use LogLevel values, to match Roslyn (and VS Code conventions) #6770

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Dec 21, 2023

Fixes dotnet/razor#9142

Razor logging used to have a setting name that didn't match the <language>.server.trace convention, used its own log levels, and the server ignored the setting anyway. This fixes all of that.

Goes with dotnet/razor#9745 and will need a Razor bump before merging

CHANGELOG.md Outdated Show resolved Hide resolved
"%configuration.razor.trace.off%",
"%configuration.razor.trace.messages%",
"%configuration.razor.trace.verbose%"
"Trace",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we still have enum descriptions?

Copy link
Contributor Author

@davidwengier davidwengier Dec 21, 2023

Choose a reason for hiding this comment

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

Personally, I don't think they add any value.

],
"description": "%configuration.razor.trace%",
"order": 90
Copy link
Member

Choose a reason for hiding this comment

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

not sure what this "order" was needed for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me neither

Copy link
Member

Choose a reason for hiding this comment

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

this ensures the Razor settings are grouped and ordered together (cc @Cosifne )

@@ -1751,21 +1751,20 @@
"description": "%configuration.razor.languageServer.debug%",
"order": 90
},
"razor.trace": {
"razor.server.trace": {
Copy link
Member

Choose a reason for hiding this comment

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

why is this still called trace when it is actually log level?

why is it not named razor.server.loglevel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just following the same convention as Roslyn. I believe its a VS Code convention too.

Copy link
Member

Choose a reason for hiding this comment

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

that's very confusing

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree it's confusing 🤷

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Does that actually change anything that vscode controls? It seems like basically another config to me.

Copy link
Member

@dibarbet dibarbet Jan 5, 2024

Choose a reason for hiding this comment

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

If you specify it exactly as they describe there, this setting will output the full json trace logs (when enabled) to the trace output channel you pass into the vscode LSP client.

Since we added that option though for roslyn, we've changed the set of values you can use, and now we have to manually convert our option values and set the trace setting on the LSP client. We do that here - https://github.com/dotnet/vscode-csharp/blob/main/src/lsptoolshost/roslynLanguageServer.ts#L137

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. So Roslyn (and with this PR, Razor) have <language>.server.trace, but the doco says <language>.trace.server. So, should we be consistent with Roslyn, or with VS Code?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it makes sense to be consistent with Roslyn (for me). We use dotnet.server.trace because

  1. Our configs have a common prefix of dotnet
  2. Our configs for server related configurations are dotnet.server.xyz
  3. Its tracing configuration, so dotnet.server.trace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we added that option though for roslyn, we've changed the set of values you can use, and now we have to manually convert our option values

Yep, this is exactly what this PR is doing too, so I agree it makes sense for the setting name to be consistent if the options are.

@davidwengier
Copy link
Contributor Author

Ping @dotnet/razor-tooling for reviews

@davidwengier davidwengier merged commit 4659bf2 into dotnet:main Jan 5, 2024
13 checks passed
@davidwengier davidwengier deleted the RazorLogging branch January 5, 2024 02:41
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.

Fix up VS Code logging
6 participants