-
Notifications
You must be signed in to change notification settings - Fork 196
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
Revisit Razor logging #10641
Merged
Merged
Revisit Razor logging #10641
Conversation
This file contains 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
While adding a new ILoggerProvider for integration tests that ignores messages sent after the output is invalid, I noticed a bunch of things to clean up. Importantly, Razor's ILoggerProvider no longer implements IDisposable as the MS.Extensions.Logging version does.
ryzngard
reviewed
Jul 18, 2024
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Outdated
Show resolved
Hide resolved
davidwengier
approved these changes
Jul 18, 2024
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/StringExtensions.cs
Outdated
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Outdated
Show resolved
Hide resolved
...Microsoft.CodeAnalysis.Razor.Workspaces/Logging/LogMessageFormatter.FormattedMessageState.cs
Outdated
Show resolved
Hide resolved
ryzngard
approved these changes
Jul 18, 2024
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Outdated
Show resolved
Hide resolved
jjonescz
reviewed
Jul 18, 2024
src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Outdated
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/StringExtensions.cs
Outdated
Show resolved
Hide resolved
jjonescz
approved these changes
Jul 19, 2024
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/MemoryBuilder`1.cs
Outdated
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/StringExtensions.cs
Show resolved
Hide resolved
maryamariyan
approved these changes
Jul 19, 2024
This was referenced Jul 23, 2024
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.
I recommend reviewing this commit-by-commit.
I took a look at logging to address an integration test issue where we should ignore any exceptions that occur during logging because xUnit's
ITestOutputHelper
is no longer available. Previously, we had swallowed these exceptions across all unit tests as well. However, in unit tests, these exceptions can be an early warning sign of other problems.While addressing integration tests, I ended up taking a more thorough look at logging and ended up re-implementing the log message formatting to reduce string allocations. In addition, I cleaned up a fair number of redundant "no-op" loggers and did an audit of all ILoggerProviders to determine which ones needed to implement IDisposable.