-
Notifications
You must be signed in to change notification settings - Fork 129
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
Support Serilog expressions in sink configuration #276
Comments
Thanks, Zach! The properties in The corresponding one that we'd need to set for If we pass a string through for I think there would be a few ways to make this work without breakage -
Pros/cons/variants of each - just getting the options out there :-) |
Hi @ZBlocker655 , @nblumhardt . I like the second option - add generic support to public constructor's arguments. I would add "Args": {
"formatter": {
// $type is mandatory because of abstract nature of argument type
"$type": "Serilog.Expressions.TemplateExpressionTemplate, Serilog.Expressions",
"template": "...",
},
// $type is optional. By default binds to argument type if it is not abstract
"concreteComplexTypeArg": {
"arg1": "..",
..
}
} Will also solve #225 |
I think I agree with @skomis-mm that option 2 is the optimal one. I like option 4 for its simplicity and expressiveness, but I'm also leery of making "special cases" that might go against convention (in this case, the convention of exposing underlying class properties. Option 3 also feels like a special case, though if it's not too much of an ugly stuck-on bit I think it would be nice as well. |
Great - also a +1 from me, for option 2.
|
Right, just forgot about environment variables and corresponding issue. We have a bit stucked PR on this. Will look into it if it can be restored. |
Inspired by this Stack Overflow question
Rather than create a formatter class to pull in an expression for sink configuration in
appsettings
, why not provide direct support for expression configuration for a sink?Example:
The text was updated successfully, but these errors were encountered: