Skip to content

Commit

Permalink
feat(config): Update Serilog configuration
Browse files Browse the repository at this point in the history
- Updated the Serilog configuration in both appsettings.Development.json and appsettings.json files.
- Added "Serilog" section with "Using", "MinimumLevel", "Enrich", and "WriteTo" properties.
- Modified the Program.cs file to use the updated Serilog configuration.
  • Loading branch information
SakuraIsayeki committed Feb 10, 2024
1 parent 7eb894a commit ea67624
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion SocialGuard.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
webBuilder.UseStartup<Startup>())
.UseSerilog();
.UseSerilog((hostingCtx, config) => config.ReadFrom.Configuration(hostingCtx.Configuration));
}
}
26 changes: 20 additions & 6 deletions SocialGuard.Api/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
"Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Enrich": [
"FromLogContext",
"WithAssemblyName"
],
"WriteTo": [
{
"Name": "Console"
}
]
},

"MongoDatabase": {
Expand Down
25 changes: 20 additions & 5 deletions SocialGuard.Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
{
"Logging": {
"LogLevel": {
"Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Enrich": [
"FromLogContext",
"WithAssemblyName"
],
"WriteTo": [
{
"Name": "Console"
}
]
},

"AllowedHosts": "*",

"MongoDatabase": {
Expand Down

0 comments on commit ea67624

Please sign in to comment.