mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 08:39:47 +00:00
Added a program logger
This commit is contained in:
parent
01e8b09101
commit
32819d3618
@ -143,12 +143,18 @@ internal sealed class Program
|
||||
// Execute the builder to get the app:
|
||||
var app = builder.Build();
|
||||
|
||||
// Get a program logger:
|
||||
var programLogger = app.Services.GetRequiredService<ILogger<Program>>();
|
||||
programLogger.LogInformation("Starting the AI Studio server.");
|
||||
|
||||
// Initialize the encryption service:
|
||||
programLogger.LogInformation("Initializing the encryption service.");
|
||||
var encryptionLogger = app.Services.GetRequiredService<ILogger<Encryption>>();
|
||||
var encryption = new Encryption(encryptionLogger, secretPassword, secretKeySalt);
|
||||
var encryptionInitializer = encryption.Initialize();
|
||||
|
||||
// Set the logger for the Rust service:
|
||||
programLogger.LogInformation("Initializing the Rust service.");
|
||||
var rustLogger = app.Services.GetRequiredService<ILogger<RustService>>();
|
||||
rust.SetLogger(rustLogger);
|
||||
rust.SetEncryptor(encryption);
|
||||
@ -156,6 +162,7 @@ internal sealed class Program
|
||||
RUST_SERVICE = rust;
|
||||
ENCRYPTION = encryption;
|
||||
|
||||
programLogger.LogInformation("Initialize internal file system.");
|
||||
app.Use(Redirect.HandlerContentAsync);
|
||||
|
||||
#if DEBUG
|
||||
@ -175,9 +182,11 @@ internal sealed class Program
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
var serverTask = app.RunAsync();
|
||||
programLogger.LogInformation("Server was started successfully.");
|
||||
|
||||
await encryptionInitializer;
|
||||
await rust.AppIsReady();
|
||||
programLogger.LogInformation("The AI Studio server is ready.");
|
||||
await serverTask;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user