Skip to content

Commit

Permalink
refactor: Culling
Browse files Browse the repository at this point in the history
  • Loading branch information
sabihoshi committed Oct 14, 2022
1 parent 2f0c5fb commit ce40b8b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions HuTao.Culling/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Serilog.Events;

namespace HuTao.Culling;

Expand Down Expand Up @@ -63,6 +64,14 @@ public async Task StartAsync(string[] args)
_services = ConfigureServices();
_db = _services.GetRequiredService<HuTaoContext>();

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);
Expand Down

0 comments on commit ce40b8b

Please sign in to comment.