feat: show bot version on startup and in /catalogger ping

This commit is contained in:
sam 2024-10-31 01:26:50 +01:00
parent a22057b9fa
commit 5ac607fd0a
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
6 changed files with 66 additions and 4 deletions

View file

@ -186,9 +186,15 @@ public static class StartupExtensions
public static async Task Initialize(this WebApplication app)
{
await BuildInfo.ReadBuildInfo();
await using var scope = app.Services.CreateAsyncScope();
var logger = scope.ServiceProvider.GetRequiredService<ILogger>().ForContext<Program>();
logger.Information("Starting Catalogger.NET");
logger.Information(
"Starting Catalogger.NET {Version} ({Hash})",
BuildInfo.Version,
BuildInfo.Hash
);
CataloggerMetrics.Startup = scope
.ServiceProvider.GetRequiredService<IClock>()