From ce40b8bfb10236d083c4b6ef287f02355f647547 Mon Sep 17 00:00:00 2001 From: sabihoshi Date: Fri, 14 Oct 2022 19:06:12 +0800 Subject: [PATCH] refactor: Culling --- HuTao.Culling/Program.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HuTao.Culling/Program.cs b/HuTao.Culling/Program.cs index ee847ce..a4907c0 100644 --- a/HuTao.Culling/Program.cs +++ b/HuTao.Culling/Program.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Serilog; +using Serilog.Events; namespace HuTao.Culling; @@ -63,6 +64,14 @@ public async Task StartAsync(string[] args) _services = ConfigureServices(); _db = _services.GetRequiredService(); + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Override("Hangfire", LogEventLevel.Debug) + .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) + .MinimumLevel.Verbose() + .Enrich.FromLogContext() + .WriteTo.Console() + .CreateLogger(); + var days = int.Parse(args.First()); var oldest = DateTimeOffset.Now.ToUniversalTime() - TimeSpan.FromDays(days); await CullMessagesInternalAsync(oldest);