serilog-settings-configuration
serilog-settings-configuration copied to clipboard
Not able to specify complex parameter
Hi,
I am trying to specify a complex parameter for subject and body for Serilog.Sinks.Email like this:
"WriteTo": [
{
"Name": "Email",
"Args": {
"options": {
"subject": {
"type": "Serilog.Formatting.Display.MessageTemplateTextFormatter, Serilog",
"outputTemplate": "Serilog test"
},
"from": "[email protected]",
"to": [ "[email protected]" ],
"host": "localhost",
"body": {
"type": "Serilog.Formatting.Display.MessageTemplateTextFormatter, Serilog",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}"
}
},
"batchingOptions": {
"batchSizeLimit": 10,
"period": "00:00:01"
},
"restrictedToMinimumLevel": "Information"
}
}
]
Unfortunately it doesn't work for subject and body. It works for the other settings. If I add a constructor to the options class, that mirrors the properties, it will work.
Is this expected behavior, or is it a bug? In other words, should this be fixed in Serilog.Settings.Configuration, or in Serilog.Sinks.Email?
Best regards