Background and motivation
When the JSON console log formatter is used properties are formatted with PascalCase
{"EventId":15,"LogLevel":"Warning","Category":"Microsoft.AspNetCore.Hosting.Diagnostics","Message":"Overriding HTTP_PORTS..."},"Scopes":[]}
I would like an option to use camelCase instead
{"eventId":15,"logLevel":"Warning","category":"Microsoft.AspNetCore.Hosting.Diagnostics","message":"Overriding HTTP_PORTS..."},"scopes":[]}
API Proposal
Add a NamingPolicy property to JsonWriterOptions.
API Usage
using System.Text.Json;
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddJsonConsole(options =>
{
options.IncludeScopes = false;
options.TimestampFormat = "HH:mm:ss ";
options.JsonWriterOptions = new JsonWriterOptions
{
Indented = true
NamingPolicy = JsonNamingPolicy.CamelCase;
};
});
}
or
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning"
},
"Console": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning"
},
"FormatterName": "json",
"FormatterOptions": {
"SingleLine": true,
"IncludeScopes": true,
"NamingPolicy": "CamelCase"
}
}
}
Alternative Designs
No response
Risks
No response
Background and motivation
When the JSON console log formatter is used properties are formatted with PascalCase
I would like an option to use camelCase instead
API Proposal
Add a
NamingPolicyproperty toJsonWriterOptions.API Usage
or
Alternative Designs
No response
Risks
No response