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.
44 lines
1.6 KiB
44 lines
1.6 KiB
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Serilog;
|
|
using Serilog.Events;
|
|
|
|
namespace Win_in.Sfs.Print.DbMigrator
|
|
{
|
|
class Program
|
|
{
|
|
static async Task Main(string[] args)
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
.MinimumLevel.Information()
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
|
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
|
|
#if DEBUG
|
|
.MinimumLevel.Override("Win_in.Sfs.Print", LogEventLevel.Debug)
|
|
#else
|
|
.MinimumLevel.Override("Win_in.Sfs.Print", LogEventLevel.Information)
|
|
#endif
|
|
.Enrich.FromLogContext()
|
|
.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)
|
|
.ConfigureAppConfiguration(build =>
|
|
{
|
|
build.AddJsonFile("appsettings.secrets.json", optional: true);
|
|
})
|
|
.ConfigureLogging((context, logging) => logging.ClearProviders())
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
services.AddHostedService<DbMigratorHostedService>();
|
|
});
|
|
}
|
|
}
|
|
|