init
This commit is contained in:
24
DouyinApi.Extensions/ServiceExtensions/ApplicationSetup.cs
Normal file
24
DouyinApi.Extensions/ServiceExtensions/ApplicationSetup.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using DouyinApi.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Serilog;
|
||||
|
||||
namespace DouyinApi.Extensions.ServiceExtensions;
|
||||
|
||||
public static class ApplicationSetup
|
||||
{
|
||||
public static void UseApplicationSetup(this WebApplication app)
|
||||
{
|
||||
app.Lifetime.ApplicationStarted.Register(() =>
|
||||
{
|
||||
App.IsRun = true;
|
||||
});
|
||||
|
||||
app.Lifetime.ApplicationStopped.Register(() =>
|
||||
{
|
||||
App.IsRun = false;
|
||||
|
||||
//清除日志
|
||||
Log.CloseAndFlush();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user