forked from amkovkov/GranuSightSoftware2
feat: add logs formatting
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user