Reputation: 705
I'm using the Serilog.Extras.AppSetting package, to configure Serilog. I'm attempting to use the Email sink (Serilog.Sinks.Email), but I can't figure out how to configure the network credentials property via an AppSetting.
<add key="serilog:using" value="Serilog.Sinks.Email" />
<add key="serilog:write-to:Email.mailServer" value="localhost" />
<add key="serilog:write-to:Email.fromEmail" value="[email protected]" />
<add key="serilog:write-to:Email.toEmail" value="[email protected]" />
<add key="serilog:write-to:Email.restrictedToMinimumLevel " value="Error" />
<add key="serilog:write-to:Email.networkCredential" value="???" />
How can I specify/represent an NetworkCredential object using AppSettings? Is it even possible, or is this a limitation of the AppSetting approach to configuration in Serilog?
Upvotes: 2
Views: 904
Reputation: 886
Does Serilog pick up settings from the <mailSettings>
element in your app.config? If not, this would make a good PR ;)
Upvotes: 0
Reputation: 31832
There isn't currently a nice way to do this, unfortunately.
Where this has popped up in the past we've sometimes added overloads with simple parameters - raising a bug or PR to that effect would be welcome.
Otherwise, reading the values out of AppSettings
manually and configuring the sink in code is the best bet.
Upvotes: 1