Add log filtering integration#460
Conversation
Aaronontheweb
left a comment
There was a problem hiding this comment.
One question about the two different ways of doing this, but otherwise looks good
|
|
||
| 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. |
| }); | ||
| ``` | ||
|
|
||
| 2. Using The `LoggerConfigBuilder.WithLogFilter()` method. |
| [Fact(DisplayName = "WithLogFilter should inject LogFilterSetup")] | ||
| public void WithLogFilterSetupTest() | ||
| { | ||
| var builder = new AkkaConfigurationBuilder(new ServiceCollection(), "fake") |
| return this; | ||
| } | ||
|
|
||
| public LoggerConfigBuilder WithLogFilter(Action<LogFilterBuilder> filterBuilder) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
LGTM - we decided to stick with just the LogConfigBuilder.
Aaronontheweb
left a comment
There was a problem hiding this comment.
LGTM (once API approvals are in)
| builder.Services.AddAkka("MyActorSystem", configurationBuilder => | ||
| { | ||
| configurationBuilder | ||
| .WithLogFilter(filterBuilder => |
There was a problem hiding this comment.
LGTM - glad we consolidated this.
No description provided.