Skip to content

Commit

Permalink
Merge pull request #362 from Reptarsrage/develop
Browse files Browse the repository at this point in the history
Fixing SErilog configuration
  • Loading branch information
Reptarsrage authored Jan 2, 2022
2 parents 1dc4830 + 5981389 commit 4efe3c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/BestClipOfTheWeek/Extensions/IWebHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ public static IWebHostBuilder AddLogging(this IWebHostBuilder webHostBuilder)
return webHostBuilder.UseSerilog((hostingContext, loggingConfiguration) =>
{
var logDirectory = hostingContext.Configuration["LogDirectory"];
if (!string.IsNullOrEmpty(logDirectory)) {
if (!string.IsNullOrEmpty(logDirectory))
{
var logPath = Path.Combine(logDirectory, "log.txt");
loggingConfiguration.WriteTo.File(logPath, rollingInterval: RollingInterval.Day);
}

loggingConfiguration
.MinimumLevel.Debug()
.ReadFrom.Configuration(hostingContext.Configuration)
.Enrich.FromLogContext()
.Enrich.WithExceptionDetails()
.WriteTo.Console();
Expand Down
11 changes: 6 additions & 5 deletions src/BestClipOfTheWeek/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"ConnectionStrings": {
"DefaultConnection": "Data Source=bcotw.sqlite"
},
"Logging": {
"LogLevel": {
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.AspNetCore.SpaProxy": "Information",
"Microsoft.Hosting.Lifetime": "Information"
"Override": {
"Microsoft": "Information",
"System": "Information"
}
}
},
"Email": {
Expand Down
10 changes: 6 additions & 4 deletions src/BestClipOfTheWeek/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"ConnectionStrings": {
"DefaultConnection": "Data Source=/var/www/bcotw/Database.sqlite"
},
"Logging": {
"LogLevel": {
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
}
},
"Email": {
Expand Down

0 comments on commit 4efe3c7

Please sign in to comment.