forked from tsai/eShopOnAbp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
784 B
24 lines
784 B
using Serilog;
|
|
using Serilog.Events;
|
|
|
|
namespace EShopOnAbp.Shared.Hosting.AspNetCore;
|
|
|
|
public static class SerilogConfigurationHelper
|
|
{
|
|
public static void Configure(string applicationName)
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
#if DEBUG
|
|
.MinimumLevel.Debug()
|
|
#else
|
|
.MinimumLevel.Information()
|
|
#endif
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
|
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
|
|
.Enrich.FromLogContext()
|
|
.Enrich.WithProperty("Application", $"{applicationName}")
|
|
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
|
.WriteTo.Async(c => c.Console())
|
|
.CreateLogger();
|
|
}
|
|
}
|