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

Revamp the logging generator to use the new redaction model. #4233

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

geeknoid
Copy link
Member

@geeknoid geeknoid commented Aug 1, 2023

  • This new code leverages LoggerMessageState to take advantage of the new ExtendedLogger design.

  • The tests were updated for three reasons:

    • Stopped using IRedactorProvider in here, this is handled by
      the ExtendedLogger

    • Fixed brittle test logic assuming the order of the name/value pairs
      produced by the logging code generator. The tests are now order-
      independent.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost assigned geeknoid Aug 1, 2023
@geeknoid geeknoid force-pushed the geeknoid/gen branch 2 times, most recently from 0e6ba86 to 32dcce8 Compare August 2, 2023 00:03
@geeknoid geeknoid requested a review from xakep139 August 2, 2023 00:04
@xakep139
Copy link
Contributor

xakep139 commented Aug 2, 2023

Stopped using LogLevel.Debug since it ends up getting filtered
away by default, and switching the default is a pain.

Why is that? You can add builder.SetMinimumLevel(LogLevel.Trace) in Utils.GetLogger()

@@ -619,36 +618,12 @@ class MyClass
internal static partial class C
{
[LogMethod(0, LogLevel.Debug, ""Only {A}"")]
static partial void M(ILogger logger, IRedactorProvider provider, [FeedbackData] string a, [LogProperties] MyClass param);
Copy link
Contributor

Choose a reason for hiding this comment

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

As @klauco pointed, we should still support this use-case. Maybe not in 3P though 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing redactor provider support was a huge simplification. I'd really need to be convinced that supporting it is a useful thing within the redaction infra.

Note that there's nothing preventing the customer from grabbing an IRedactorProvider themselves and redacting stuff on their own before calling the lower-level log method.

Copy link

Choose a reason for hiding this comment

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

can we provide analyzer and fixer for existing customers, to move to the signature which does not use IRedactorProvider?

@geeknoid
Copy link
Member Author

geeknoid commented Aug 2, 2023

Stopped using LogLevel.Debug since it ends up getting filtered
away by default, and switching the default is a pain.

Why is that? You can add builder.SetMinimumLevel(LogLevel.Trace) in Utils.GetLogger()

Oh, let me try that. I was trying to figure out how to change the default minimum level and just didn't land on a solution.

@geeknoid geeknoid merged commit 9e854f8 into main Aug 3, 2023
6 checks passed
@geeknoid geeknoid deleted the geeknoid/gen branch August 3, 2023 14:42
@ghost ghost added this to the 8.0 RC1 milestone Aug 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants