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 log filtering integration #460

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

Arkatufus
Copy link
Contributor

No description provided.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

One question about the two different ways of doing this, but otherwise looks good

README.md Outdated

In Akka.NET 1.5.21, we introduced [log filtering for log messages based on the LogSource or the content of a log message](https://getakka.net/articles/utilities/logging.html#filtering-log-messages). Depending on your coding style, you can use this feature in Akka.Hosting in several ways.

1. Using the `WithLogFilter()` `AkkaConfigurationBuilder` extension method.
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

README.md Outdated
});
```

2. Using The `LoggerConfigBuilder.WithLogFilter()` method.
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

[Fact(DisplayName = "WithLogFilter should inject LogFilterSetup")]
public void WithLogFilterSetupTest()
{
var builder = new AkkaConfigurationBuilder(new ServiceCollection(), "fake")
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

@@ -96,6 +98,13 @@ public LoggerConfigBuilder ClearLoggers()
return this;
}

public LoggerConfigBuilder WithLogFilter(Action<LogFilterBuilder> filterBuilder)
Copy link
Member

Choose a reason for hiding this comment

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

One thing I'm not so sure about - what happens if someone calls this and ConfigureLogging (or whatever it's called?) - can't we end up with one config overriding the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the two implementation inside ConfigureLoggers(builder) and the extension method AkkaConfigurationBuilder.WithLogFilter() is exclusive to each other. The first being added would win because of how we retrieve Setup classes in ActorSystem.Settings

Copy link
Member

Choose a reason for hiding this comment

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

LGTM - we decided to stick with just the LogConfigBuilder.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

LGTM (once API approvals are in)

README.md Outdated
builder.Services.AddAkka("MyActorSystem", configurationBuilder =>
{
configurationBuilder
.WithLogFilter(filterBuilder =>
Copy link
Member

Choose a reason for hiding this comment

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

LGTM - glad we consolidated this.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 4, 2024 20:18
@Aaronontheweb Aaronontheweb merged commit 6719082 into akkadotnet:dev Jun 4, 2024
2 checks passed
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