From c31cc9984457ceaf5574ca3b26aa12e0651a08fd Mon Sep 17 00:00:00 2001 From: alex289 Date: Sun, 9 Jul 2023 15:17:27 +0200 Subject: [PATCH] Add logging --- CleanArchitecture.Api/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CleanArchitecture.Api/Program.cs b/CleanArchitecture.Api/Program.cs index 6be1f06..da17e91 100644 --- a/CleanArchitecture.Api/Program.cs +++ b/CleanArchitecture.Api/Program.cs @@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; var builder = WebApplication.CreateBuilder(args); @@ -49,6 +50,12 @@ builder.Services.AddApiUser(); builder.Services.AddMediatR(cfg => { cfg.RegisterServicesFromAssemblies(typeof(Program).Assembly); }); +builder.Services.AddLogging(x => x.AddSimpleConsole(console => +{ + console.TimestampFormat = "[yyyy-MM-ddTHH:mm:ss.fff] "; + console.IncludeScopes = true; +})); + var app = builder.Build(); using (var scope = app.Services.CreateScope())