From a845cff7e28e5ddf596d4ca05750b1778a4ae180 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 20 Mar 2025 16:19:00 +0100 Subject: [PATCH] Added the logger factory for static classes --- app/MindWork AI Studio/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/MindWork AI Studio/Program.cs b/app/MindWork AI Studio/Program.cs index 61261b16..cc37d9cd 100644 --- a/app/MindWork AI Studio/Program.cs +++ b/app/MindWork AI Studio/Program.cs @@ -22,6 +22,7 @@ internal sealed class Program public static Encryption ENCRYPTION = null!; public static string API_TOKEN = null!; public static IServiceProvider SERVICE_PROVIDER = null!; + public static ILoggerFactory LOGGER_FACTORY = null!; public static async Task Main(string[] args) { @@ -147,6 +148,9 @@ internal sealed class Program // Execute the builder to get the app: var app = builder.Build(); + // Get the logging factory for e.g., static classes: + LOGGER_FACTORY = app.Services.GetRequiredService(); + // Get a program logger: var programLogger = app.Services.GetRequiredService>(); programLogger.LogInformation("Starting the AI Studio server.");