feat: add SerilogRegistrar and ContextualSerilogLogger
- IContextualSerilogLogger<T> / ContextualSerilogLogger<T> in Services/Logging (handlers get a ForContext<T>-scoped logger via DI, consistent with ItemTracker) - SerilogRegistrar extension on WebApplicationBuilder (Api) - SerilogRegistrar extension on HostApplicationBuilder (Worker) - Both registrars: set Log.Logger, wire Logging + Host/Services, register ILogger singleton - ServiceCollectionExtensions: register IContextualSerilogLogger<> as transient - Program.cs in both apps simplified to single builder.AddSerilog() call Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
using Serilog;
|
||||
|
||||
namespace HrynCo.NotificationService.Services.Logging;
|
||||
|
||||
public sealed class ContextualSerilogLogger<TContext> : IContextualSerilogLogger<TContext>
|
||||
{
|
||||
public ILogger Logger { get; } = Log.ForContext<TContext>();
|
||||
}
|
||||
Reference in New Issue
Block a user