Replace Logging with Serilog; add new configurations
Replaced the `Logging` configuration in both `appsettings.json` and `appsettings.Development.json` with Serilog, enabling structured logging with configurable sinks and enrichment. Added `DocumentOperatorSettings` to manage temporary files and logging details. Introduced `RedisSettings` for Redis integration, including connection string and cache settings. Added `ApiKeySettings` to support tenant-specific API key validation with detailed configuration for each tenant. These changes improve logging, caching, and configuration management for better maintainability and extensibility.
This commit is contained in:
@@ -1,8 +1,16 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Serilog": {
|
||||||
"LogLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Debug"
|
||||||
"Microsoft.AspNetCore": "Warning"
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"DocumentOperatorSettings": {
|
||||||
|
"TempFolderPath": "C:\\Temp\\DocumentOperator\\Dev",
|
||||||
|
"EnableDetailedLogging": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"RedisSettings": {
|
||||||
|
"ConnectionString": "localhost:6379"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,62 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
|
"Serilog": {
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Override": {
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"System": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console",
|
||||||
|
"Args": {
|
||||||
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "Logs/log-.txt",
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
|
||||||
|
},
|
||||||
|
|
||||||
|
"DocumentOperatorSettings": {
|
||||||
|
"TempFolderPath": "C:\\Temp\\DocumentOperator",
|
||||||
|
"TempFileRetentionHours": 24,
|
||||||
|
"MaxPdfSizeMB": 50,
|
||||||
|
"EnableDetailedLogging": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"RedisSettings": {
|
||||||
|
"ConnectionString": "localhost:6379",
|
||||||
|
"InstanceName": "DocumentOperator:",
|
||||||
|
"CacheExpirationMinutes": 60
|
||||||
|
},
|
||||||
|
|
||||||
|
"ApiKeySettings": {
|
||||||
|
"EnableValidation": true,
|
||||||
|
"Keys": {
|
||||||
|
"customer-a-key-12345": {
|
||||||
|
"TenantId": "customer-a",
|
||||||
|
"TenantName": "Customer A GmbH",
|
||||||
|
"IsActive": true
|
||||||
|
},
|
||||||
|
"customer-b-key-67890": {
|
||||||
|
"TenantId": "customer-b",
|
||||||
|
"TenantName": "Customer B AG",
|
||||||
|
"IsActive": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user