-
Notifications
You must be signed in to change notification settings - Fork 119
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
Can I somehow pass formatter args in appsettings.json? #138
Comments
Hi! There are a couple of similar issues over in the Serilog.Settings.Configuration repo. In a nutshell, it's not possible to pass parameters to constructors at present. I haven't tried this, but I guess a kind of workaround would be to create your own class that extended the formatter in question and provided the values you want (with a parameterless ctor!) |
Ok, thank you. |
Not a problem, I'm happy to help 😄 |
I think this is possible now. refer serilog/serilog-settings-configuration#225 (comment) {
"Name": "File",
"Args": {
"path": "log.json",
"rollingInterval": "Day",
"retainedFileCountLimit": 7,
"formatter": {
"type": "Serilog.Formatting.Json.JsonFormatter, Serilog",
"renderMessage": true
}
}
} |
In code I can setup formatter like this
Can I do the same thing in appsettings.json?
This one does not work:
The text was updated successfully, but these errors were encountered: