feat: add logs formatting

This commit is contained in:
2025-12-19 09:35:23 +03:00
parent 18a50b745d
commit 717efe6781
6 changed files with 279 additions and 1 deletions
+8
View File
@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using GSS2.Core;
using GSS2.Core.Analysis.AmineContent.Database;
using Microsoft.Extensions.Logging.Console;
namespace GSS2.Test;
@@ -10,6 +11,12 @@ public class Program
{
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddConsole(options => options.FormatterName = nameof(ConsoleFormatter));
builder.Logging.AddConsoleFormatter<ConsoleFormatter, ConsoleFormatterOptions>();
builder.Logging.AddProvider(new FileLoggerProvider("app.log"));
builder.Services.AddSingleton<LibCameraLogSink>();
builder.Services.AddAmineContentCalibrationContext(builder.Configuration);
builder.Services.AddAmineContentResultsContext(builder.Configuration);
@@ -21,6 +28,7 @@ public class Program
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Services.GetRequiredService<LibCameraLogSink>();
using (var scope = host.Services.CreateScope())
{