-
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
Extension method specially designed for JSON #53
Comments
Thanks for the feedback!
Specifying the type name will work here - the provider translates type names to
This is already a breaking change in C#, since they can be provided by name: .WriteTo.SomeSink(foo: "bar")
Not as yet, but this ticket could be a conduit for some discussion around this 👍 |
Yes, but I wouldn't wan't to expose this to the consumers using the C# API, it would serve no benefit other than supporting JSON.
I guess you are right about that |
Closing it due to lack of interest. |
There is definitely interest. Is there a way currently to configure Stackify sink in Serilog's json configuration file/section? |
Good news! The feature described below is possible as of PR#100. It is currently available in the pre-release (dev) NuGet package.
Sink authors can declare an optional |
With this PR, is it possible for me to create a new extensions method with only the Or is this more of a complementary thing in that consumers can provide configuration in the optional argument, configuration that for some reason isn't described by any of the other arguments in the extension method? |
@FantasticFiasco Yes, that would work. Of course, since this is all open source, you could also just update the sinks of interest (as I'm doing with SQL)... |
I realize that having
Serilog.Settings.Configuration
to depend on the extension methods of the sinks is extremely clever, since out of the gate you will have support for almost all sink already published.But building it on the extension methods can also, at least for me as a sink author, be fragile. I was not aware of
Serilog.Settings.Configuration
, and had no idea that the argument names of my extension methods where of such importance, and renaming one would be a breaking change.I would like to propose a solution where sink authors could opt in for providing a configuration method that was specially designed for the JSON configuration. Is that something other sink authors have requested?
This new configuration method would get the JSON relevant to the sink in the form of a
IConfigurationSection
or similar, and handle the parsing themselves. That way I would be able define a good API both for those that configure the sink using C# and those that prefer JSON.As an example, one of the arguments to the extension method creating the HTTP sink allows the consumer to specify an implementation on a
HttpClient
. That is fine in C#, but more problematic in JSON. I think I would have a better chance at creating a good JSON API if it was handled separately from the C# configuration.The text was updated successfully, but these errors were encountered: