feat: add git commit hash to Serilog context
This commit is contained in:
parent
2e387ecee9
commit
c38ca2e7fa
@ -115,7 +115,7 @@ public class Startup
|
||||
// add X-PluralKit-Version header
|
||||
app.Use((ctx, next) =>
|
||||
{
|
||||
ctx.Response.Headers.Add("X-PluralKit-Version", BuildInfoService.Version);
|
||||
ctx.Response.Headers.Add("X-PluralKit-Version", BuildInfoService.FullVersion);
|
||||
return next();
|
||||
});
|
||||
|
||||
|
@ -16,20 +16,20 @@ namespace PluralKit.Bot;
|
||||
|
||||
public class Init
|
||||
{
|
||||
private static Task Main(string[] args)
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
// Load configuration and run global init stuff
|
||||
var config = InitUtils.BuildConfiguration(args).Build();
|
||||
InitUtils.InitStatic();
|
||||
|
||||
// Set up DI container and modules
|
||||
var services = BuildContainer(config);
|
||||
|
||||
return RunWrapper(services, async ct =>
|
||||
{
|
||||
// init version service
|
||||
await BuildInfoService.LoadVersion();
|
||||
|
||||
// Set up DI container and modules
|
||||
var services = BuildContainer(config);
|
||||
|
||||
await RunWrapper(services, async ct =>
|
||||
{
|
||||
var logger = services.Resolve<ILogger>().ForContext<Init>();
|
||||
|
||||
// Initialize Sentry SDK, and make sure it gets dropped at the end
|
||||
|
@ -52,6 +52,7 @@ public class LoggingModule: Module
|
||||
|
||||
var logCfg = _cfg
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithProperty("GitCommitHash", BuildInfoService.FullVersion)
|
||||
.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)
|
||||
.Enrich.WithProperty("Component", _component)
|
||||
.MinimumLevel.Is(config.ConsoleLogLevel)
|
||||
|
@ -16,6 +16,8 @@ internal class Startup
|
||||
var config = InitUtils.BuildConfiguration(args).Build();
|
||||
InitUtils.InitStatic();
|
||||
|
||||
await BuildInfoService.LoadVersion();
|
||||
|
||||
var services = BuildContainer(config);
|
||||
services.Resolve<TaskHandler>().Run();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user