Add a callback on the reader options to expose the log filter switches - #366
Conversation
|
|
||
| _resolutionContext.AddFilterSwitch(switchName, filterSwitch); | ||
| var referenceName = _resolutionContext.AddFilterSwitch(switchName, filterSwitch); | ||
| _resolutionContext.ReaderOptions.OnFilterSwitchCreated?.Invoke(referenceName, filterSwitch); |
There was a problem hiding this comment.
I think the $ sign make sense only for a sink parameter in appsettings.json to distinguish parameter value from variable reference:
"Filter": [
{
"Name": "ControlledBy",
"Args": {
"switch": "$filterSwitch"
}
}
]And since #231 $ is optional in declaration section, leaving name as is should look more consistent with overrides.
There was a problem hiding this comment.
@0xced any thoughts on this one? (I'm working on merging everything through for a v7 shortly, would be great to get this PR in however this goes)
There was a problem hiding this comment.
I haven't forgotten about this. I will reply soon but I want to first experiment with a real world scenario to figure out what's best.
There was a problem hiding this comment.
I agree with you that there's no need to force the leading $. So I addressed this in 7f5c27f.
Just like it was done for log level switches in serilog#352.
Just like it was done for log level switches in #352.