Description
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.