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.
35 lines
1.2 KiB
35 lines
1.2 KiB
using System.Threading.Tasks;
|
|
using EShopOnAbp.DbMigrator;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Serilog;
|
|
using Serilog.Events;
|
|
|
|
class Program
|
|
{
|
|
async static Task Main(string[] args)
|
|
{
|
|
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", $"DbMigrator")
|
|
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
|
.WriteTo.Async(c => c.Console())
|
|
.CreateLogger();
|
|
|
|
await CreateHostBuilder(args).RunConsoleAsync();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.AddAppSettingsSecretsJson()
|
|
.ConfigureLogging((context, logging) => logging.ClearProviders())
|
|
.ConfigureServices((hostContext, services) => { services.AddHostedService<DbMigratorHostedService>(); });
|
|
}
|