-
Notifications
You must be signed in to change notification settings - Fork 831
Description
For symmetry with serilog/serilog-settings-configuration#71
For consistency with the way interface
s parameter are handled
For parameters of configuration methods whose type is an abstract class
, the key-value settings format should accept as value the fully-qualified type name of a subclass of this abstract class that has a default constructor.
The typical use-case for this enhancement is Serilog.Sinks.Console whose configuration method looks like this :
public static LoggerConfiguration Console(
this LoggerSinkConfiguration sinkConfiguration,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
string outputTemplate = DefaultConsoleOutputTemplate,
IFormatProvider formatProvider = null,
LoggingLevelSwitch levelSwitch = null,
LogEventLevel? standardErrorFromLevel = null,
ConsoleTheme theme = null)
where ConsoleTheme
is defined as public abstract class ConsoleTheme
.
Given a class
namespace MyCustom.NameSpace
{
public class MyCustomTheme:ConsoleTheme
{
public MyCustomTheme(){
}
// snip ...
}
}
We should be able to configure the console sink like so :
<configuration>
<appSettings>
<add key="serilog:using:Console" value="Serilog.Sinks.Console" />
<add key="serilog:write-to:Console.theme" value="MyCustom.NameSpace.MyCustomTheme" />
I'm not sure how "qualified" the type name needs to be here, or whether adding using:
statements are needed, but the behavior should be similar to the way interfaces are processed
( serilog/serilog-sinks-console#28 seems to mean that name must be assembly-qualified at least in Serilog.Settings.Configuration )