From 0bc45bd8b9c83776be83a005a64ff227312c2c7b Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 8 Nov 2026 22:55:45 +0330 Subject: [PATCH] add using XLoggingService ... --- Startup.cs | 5 +++++ appsettings.json | 34 +++++++++++++++++++++++++++++++++- xAiMcpServer.csproj | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Startup.cs b/Startup.cs index 45f1adf..d2b0c93 100644 --- a/Startup.cs +++ b/Startup.cs @@ -4,6 +4,7 @@ using System.Net.Http; using xAiMcpServer.DI; using Newtonsoft.Json; using System.Reflection; +using xLoggingService.DI; using xIdentityService.DI; using xCommons.Extensions; using xAiService.Extensions; @@ -42,6 +43,10 @@ namespace xAiMcpServer services.AddXAppConfiguration(Configuration); var appConfiguration = services.GetRegisteredService(); + // + // Register Logging Service ... + services.AddXLoggingService(Configuration); + // // Register Allowed Origins ... services.AddXCors(appConfiguration.AllowedOrigins); diff --git a/appsettings.json b/appsettings.json index 726cc50..944b037 100644 --- a/appsettings.json +++ b/appsettings.json @@ -33,7 +33,7 @@ "DefaultClientTimeout": -1 }, "LinkExtractionToolConfiguration": { - "MaxLinks": 5, + "MaxLinks": 5, "MaxChars": 8000 }, "WebSearchToolConfiguration": { @@ -46,6 +46,38 @@ "HtmlEndpoint": "https://html.duckduckgo.com/html/", "LiteEndpoint": "https://lite.duckduckgo.com/lite/" }, + "LoggingServiceConfiguration": { + "Enabled": true, + "MinimumLevel": "Information", + "Queue": { + "Enabled": true, + "Capacity": 10000, + "ShutdownTimeoutSeconds": 10 + }, + "File": { + "Enabled": true, + "Format": "Json", + "Directory": "./Logs", + "RetainedFileCountLimit": 30, + "MinimumLevel": "Information", + "FileName": "xAiMcpServer-.log" + }, + "Database": { + "Enabled": false, + "TableName": "XLogs", + "AutoCreateTable": true, + "MinimumLevel": "Warning", + "Provider": "Microsoft.Data.Sqlite", + "ConnectionString": "Filename=./Db/XLogs.db" + }, + "Event": { + "Enabled": false, + "MinimumLevel": "Error", + "Sender": "xAiMcpServer", + "Topic": "application-logs", + "Action": "ApplicationLogCreated" + } + }, "Logging": { "LogLevel": { "Microsoft": "Warning", diff --git a/xAiMcpServer.csproj b/xAiMcpServer.csproj index 721bbde..25e979e 100644 --- a/xAiMcpServer.csproj +++ b/xAiMcpServer.csproj @@ -35,6 +35,7 @@ +