mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 04:44:20 +01:00
Submodule update & logging improvements
This commit is contained in:
parent
8651ea50b6
commit
d90145321f
2
DotBased
2
DotBased
|
@ -1 +1 @@
|
||||||
Subproject commit 91476907f01a70739c250462f402667c4a6f84f5
|
Subproject commit 7ec3257eac08b30e5d701f06f280a0796e4f664d
|
|
@ -4,53 +4,15 @@
|
||||||
"Server": "SQLite",
|
"Server": "SQLite",
|
||||||
"Connection": "Data Source=SRSS.db"
|
"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":
|
"HTTP":
|
||||||
{
|
{
|
||||||
"HSTS":
|
"HSTS":
|
||||||
{
|
{
|
||||||
"EnableHSTS": true,
|
"EnableHSTS": true,
|
||||||
"MaxAgeSeconds": 300,
|
"MaxAgeSeconds": 31536000,
|
||||||
"IncludeSubdomains": true,
|
"IncludeSubdomains": true,
|
||||||
"Preload": true
|
"Preload": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,45 +4,6 @@
|
||||||
"Server": "SQLite",
|
"Server": "SQLite",
|
||||||
"Connection": "Data Source=SRSS.db"
|
"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":
|
"HTTP":
|
||||||
{
|
{
|
||||||
"HSTS":
|
"HSTS":
|
||||||
|
|
|
@ -19,15 +19,31 @@ public static class DependencyInjection
|
||||||
public static WebApplicationBuilder AddSRSS(this WebApplicationBuilder builder)
|
public static WebApplicationBuilder AddSRSS(this WebApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Logging (serilog)
|
* Logging
|
||||||
*/
|
*/
|
||||||
var serilogConfig = new LoggerConfiguration().ReadFrom.Configuration(builder.Configuration).UseBasedExtension();
|
LogService.Initialize(options =>
|
||||||
Log.Logger = serilogConfig.CreateLogger();
|
{
|
||||||
|
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));
|
LogService.AddLogAdapter(new BasedSerilogAdapter(Log.Logger));
|
||||||
var _logger = LogService.RegisterLogger(typeof(DependencyInjection));
|
var _logger = LogService.RegisterLogger(typeof(DependencyInjection));
|
||||||
|
|
||||||
builder.Logging.ClearProviders();
|
builder.Logging.ClearProviders();
|
||||||
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
builder.Logging.AddDotBasedLoggerProvider(LogService.Options);
|
builder.Logging.AddDotBasedLoggerProvider(LogService.Options);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user