Improved default log level definition
This commit is contained in:
@@ -38,8 +38,15 @@ public static class Startup
|
|||||||
// Ensure logging config, add a default one is missing
|
// Ensure logging config, add a default one is missing
|
||||||
if (!File.Exists(logConfigPath))
|
if (!File.Exists(logConfigPath))
|
||||||
{
|
{
|
||||||
await File.WriteAllTextAsync(logConfigPath,
|
var logLevels = new Dictionary<string, string>
|
||||||
"{\"LogLevel\":{\"Default\":\"Information\",\"Microsoft.AspNetCore\":\"Warning\",\"MoonCore.Extended.Helpers.JwtHelper\": \"Error\"}}");
|
{
|
||||||
|
{ "Default", "Information" },
|
||||||
|
{ "Microsoft.AspNetCore", "Warning" }
|
||||||
|
};
|
||||||
|
|
||||||
|
var logLevelsJson = JsonSerializer.Serialize(logLevels);
|
||||||
|
var logConfig = "{\"LogLevel\":" + logLevelsJson + "}";
|
||||||
|
await File.WriteAllTextAsync(logConfigPath, logConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Logging.AddConfiguration(await File.ReadAllTextAsync(logConfigPath));
|
builder.Logging.AddConfiguration(await File.ReadAllTextAsync(logConfigPath));
|
||||||
|
|||||||
Reference in New Issue
Block a user