diff --git a/DotBased b/DotBased index 9147690..7ec3257 160000 --- a/DotBased +++ b/DotBased @@ -1 +1 @@ -Subproject commit 91476907f01a70739c250462f402667c4a6f84f5 +Subproject commit 7ec3257eac08b30e5d701f06f280a0796e4f664d diff --git a/SharpRSS.Blazor/appsettings.Development.json b/SharpRSS.Blazor/appsettings.Development.json index c7523c3..8a3a690 100644 --- a/SharpRSS.Blazor/appsettings.Development.json +++ b/SharpRSS.Blazor/appsettings.Development.json @@ -4,53 +4,15 @@ "Server": "SQLite", "Connection": "Data Source=SRSS.db" }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], - "MinimumLevel": { - "Default": "Debug", - "Override": { - "System": "Information", - "Microsoft": "Debug", - "Microsoft.Hosting.Lifetime": "Debug", - "Microsoft.AspNetCore": "Debug", - "Microsoft.AspNetCore.Authentication": "Debug" - } - }, - "WriteTo": [ - { - "Name": "Console", - "Args": - { - "outputTemplate": "[{Timestamp:HH:mm:ss} - {Caller}->{Assembly}] | {Level:u3}] {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": - { - "path": "Logs/Debug/log_.log", - "RollingInterval": "Day", - "outputTemplate": "[{Timestamp:HH:mm:ss} - {Caller}->{Assembly}] | {Level:u3}] {Message:lj}{NewLine}{Exception}" - } - } - ], - "Destructure": [ - { "Name": "ToMaximumDepth", "Args": { "maximumDestructuringDepth": 4 } }, - { "Name": "ToMaximumStringLength", "Args": { "maximumStringLength": 100 } }, - { "Name": "ToMaximumCollectionCount", "Args": { "maximumCollectionCount": 10 } } - ], - "Properties": { - "Application": "SharpRSS" - } - }, "HTTP": { "HSTS": { "EnableHSTS": true, - "MaxAgeSeconds": 300, + "MaxAgeSeconds": 31536000, "IncludeSubdomains": true, "Preload": true } - } + }, + "AllowedHosts": "*" } diff --git a/SharpRSS.Blazor/appsettings.json b/SharpRSS.Blazor/appsettings.json index c3063ea..8a3a690 100644 --- a/SharpRSS.Blazor/appsettings.json +++ b/SharpRSS.Blazor/appsettings.json @@ -4,45 +4,6 @@ "Server": "SQLite", "Connection": "Data Source=SRSS.db" }, - "Serilog": { - "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], - "MinimumLevel": { - "Default": "Information", - "Override": { - "System": "Information", - "Microsoft": "Information", - "Microsoft.Hosting.Lifetime": "Information", - "Microsoft.AspNetCore": "Warning", - "Microsoft.AspNetCore.Authentication": "Information" - } - }, - "WriteTo": [ - { - "Name": "Console", - "Args": - { - "outputTemplate": "[{Timestamp:HH:mm:ss} - {Caller}->{Assembly}] | {Level:u3}] {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": - { - "path": "Logs/Debug/log_.log", - "RollingInterval": "Day", - "outputTemplate": "[{Timestamp:HH:mm:ss} - {Caller}->{Assembly}] | {Level:u3}] {Message:lj}{NewLine}{Exception}" - } - } - ], - "Destructure": [ - { "Name": "ToMaximumDepth", "Args": { "maximumDestructuringDepth": 4 } }, - { "Name": "ToMaximumStringLength", "Args": { "maximumStringLength": 100 } }, - { "Name": "ToMaximumCollectionCount", "Args": { "maximumCollectionCount": 10 } } - ], - "Properties": { - "Application": "SharpRSS" - } - }, "HTTP": { "HSTS": diff --git a/SharpRSS.Business/DependencyInjection.cs b/SharpRSS.Business/DependencyInjection.cs index 977b0ad..8f695e8 100644 --- a/SharpRSS.Business/DependencyInjection.cs +++ b/SharpRSS.Business/DependencyInjection.cs @@ -19,15 +19,31 @@ public static class DependencyInjection public static WebApplicationBuilder AddSRSS(this WebApplicationBuilder builder) { /* - * Logging (serilog) + * Logging */ - var serilogConfig = new LoggerConfiguration().ReadFrom.Configuration(builder.Configuration).UseBasedExtension(); - Log.Logger = serilogConfig.CreateLogger(); + LogService.Initialize(options => + { + options.Severity = LogSeverity.Verbose; + options.AddSeverityFilter("Microsoft", LogSeverity.Info); + options.AddSeverityFilter("Microsoft.Hosting.Lifetime", LogSeverity.Info); + options.AddSeverityFilter("Microsoft.AspNetCore", LogSeverity.Warning); + options.AddSeverityFilter("Microsoft.AspNetCore.Authentication", LogSeverity.Info); + options.AddSeverityFilter("MudBlazor", LogSeverity.Info); + }); + Log.Logger = new LoggerConfiguration().UseBasedExtension() + .MinimumLevel.Verbose() + .Enrich.WithProperty("Application", "SharpRSS") + .WriteTo.Console(outputTemplate: BasedSerilog.OutputTemplate) + .WriteTo.File(path: Path.Combine("Logs", "Debug", "log_.log"), rollingInterval: RollingInterval.Day, outputTemplate: BasedSerilog.OutputTemplate) + .Destructure.ToMaximumDepth(4) + .Destructure.ToMaximumStringLength(100) + .Destructure.ToMaximumCollectionCount(10).CreateLogger(); LogService.AddLogAdapter(new BasedSerilogAdapter(Log.Logger)); var _logger = LogService.RegisterLogger(typeof(DependencyInjection)); builder.Logging.ClearProviders(); + builder.Logging.SetMinimumLevel(LogLevel.Trace); builder.Logging.AddDotBasedLoggerProvider(LogService.Options); /*