Пример #1
0
 public static IHostBuilder CreateHostBuilder(string[] args) =>
 Host.CreateDefaultBuilder(args)
 .ConfigureLogging((hostBuilderContext, logging) => {
     var coloredConsoleConfiguration = new ColoredConsoleConfiguration();
     logging.ClearProviders();
     logging.AddConfiguration(hostBuilderContext.Configuration.GetSection("logging"));
     logging.AddProvider(new ColoredConsoleLoggerProvider(coloredConsoleConfiguration));
 })
 .ConfigureServices((hostContext, services) =>
 {
     services.AddHostedService <Worker>();
 });
 public ColoredConsoleLogger(ColoredConsoleConfiguration config)
 {
     _config = config;
 }