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.
|
|
|
|
using Serilog;
|
|
|
|
|
using Serilog.Events;
|
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Volo.Abp;
|
|
|
|
|
using Volo.Abp.Threading;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleClientDemo
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
private static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
InitializeSerilog();
|
|
|
|
|
|
|
|
|
|
Log.Information("Starting ConsoleClientDemo...");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (var application = AbpApplicationFactory.Create<ConsoleClientDemoModule>(options =>
|
|
|
|
|
{
|
|
|
|
|
options.Services.AddLogging(loggingBuilder =>
|
|
|
|
|
{
|
|
|
|
|
loggingBuilder.AddSerilog(dispose: true);
|
|
|
|
|
});
|
|
|
|
|
}))
|
|
|
|
|
{
|
|
|
|
|
application.Initialize();
|
|
|
|
|
|
|
|
|
|
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>();
|
|
|
|
|
AsyncHelper.RunSync(() => demo.RunAsync());
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Press ENTER to stop application...");
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(ex.Message);
|
|
|
|
|
Log.Error(ex.StackTrace);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void InitializeSerilog()
|
|
|
|
|
{
|
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
|
|
|
.MinimumLevel.Debug()
|
|
|
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
|
|
|
|
.Enrich.FromLogContext()
|
|
|
|
|
.WriteTo.File("Logs/logs.txt")
|
|
|
|
|
.CreateLogger();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|