25 lines
763 B
C#
25 lines
763 B
C#
using Autofac;
|
|
using System.Reflection;
|
|
using Serilog;
|
|
using webapi.Helpers.SerilogHelpers;
|
|
using AutofacSerilogIntegration;
|
|
|
|
namespace webapi
|
|
{
|
|
public static class LoggerConfig
|
|
{
|
|
public static void Register(ContainerBuilder builder)
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
.ReadFrom.AppSettings()
|
|
.Destructure.With<JsonDestructuringPolicy>()
|
|
.WriteTo.RollingFile("log-{Date}.txt")
|
|
.Enrich.WithProperty("version", Assembly.GetExecutingAssembly().GetName().Version)
|
|
.Enrich.WithProperty("module", "webapi")
|
|
//.Enrich.With<OrderEnricher>()
|
|
.CreateLogger();
|
|
|
|
builder.RegisterLogger();
|
|
}
|
|
}
|
|
} |