Compare commits

..
4 Commits
Author SHA1 Message Date
saherelm e1cc28edc6 add config for cache ttl ... 2026-11-15 21:26:29 +03:30
saherelm be08a4d287 make it using global ip ... 2026-11-09 15:41:58 +03:30
saherelm 98f6af7ce5 - .gitignore: +Logs
- Program.cs: Telemetry configuration
- Startup.cs: Request logging middleware
2026-11-09 12:52:43 +03:30
saherelm 0bc45bd8b9 add using XLoggingService ... 2026-11-08 22:55:45 +03:30
6 changed files with 54 additions and 3 deletions
+1
View File
@@ -1,6 +1,7 @@
#
bin/*
obj/*
Logs
#
Db/*
+5 -1
View File
@@ -1,4 +1,5 @@
using System.Text;
using xLoggingService.DI;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
@@ -19,10 +20,13 @@ namespace xAiMcpServer
{
//
var result = Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
logging.AddXTelemetryLogger())
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
})
.AddXTelemetry();
//
return result;
+1 -1
View File
@@ -21,7 +21,7 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "https://localhost:7001;http://localhost:7000",
"applicationUrl": "https://localhost:7001;http://localhost:7000;https://0.0.0.0:7001;",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+12
View File
@@ -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<XAppConfiguration>();
//
// Register Logging Service ...
services.AddXLoggingService(Configuration);
//
// Register Allowed Origins ...
services.AddXCors(appConfiguration.AllowedOrigins);
@@ -135,6 +140,13 @@ namespace xAiMcpServer
// Using Routing ...
app.UseRouting();
//
// Using Request Logging ...
if (!isDevelopmentEnvironment)
{
app.UseXRequestLogger();
}
//
// Use xIdentityService (Authentication) ...
app.UseXIdentityService();
+34 -1
View File
@@ -4,6 +4,7 @@
"DefaultLanguage": "fa-IR",
"XPoweredValue": "SaherElmITCenter",
"WelcomeMessage": "Welcome to xSaherElm Project's AI Mcp Server",
"DefaultCacheTtlMinutes": 10,
"SwaggerConfiguration": {
"Version": "v1.0",
"Title": "xSaherElm AI Mcp Server",
@@ -33,7 +34,7 @@
"DefaultClientTimeout": -1
},
"LinkExtractionToolConfiguration": {
"MaxLinks": 5,
"MaxLinks": 5,
"MaxChars": 8000
},
"WebSearchToolConfiguration": {
@@ -46,6 +47,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",
+1
View File
@@ -35,6 +35,7 @@
<ItemGroup>
<ProjectReference Include="../Modules/xCommons/xCommons.csproj" />
<ProjectReference Include="../Modules/xAiService/xAiService.csproj" />
<ProjectReference Include="../Modules/xLoggingService/xLoggingService.csproj" />
<ProjectReference Include="../Modules/xIdentityHelper/xIdentityHelper.csproj" />
</ItemGroup>