Added the logger factory for static classes

This commit is contained in:
Thorsten Sommer 2025-03-20 16:19:00 +01:00
parent abeee2408f
commit a845cff7e2
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -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<ILoggerFactory>();
// Get a program logger:
var programLogger = app.Services.GetRequiredService<ILogger<Program>>();
programLogger.LogInformation("Starting the AI Studio server.");