private Microsoft.Extensions.Logging.ILogger CreateLogger(IAppLoggerConfig loggerConfig) { var serilogConf = loggerConfig.GetLoggerConfig(); var loggerConf = new LoggerConfiguration() .ReadFrom.ConfigurationSection(serilogConf); if (!_loggerExtensions.NullOrEmpty()) { foreach (var extension in _loggerExtensions) { loggerConf = extension.AddExtension(loggerConf); } } var logger = loggerConf.CreateLogger(); return(new LoggerFactory() .AddSerilog(logger) .CreateLogger(loggerConfig.LoggerName)); }
public AppLoggerSerilog(IAppLoggerConfig config, IEnumerable <IAppLoggerExtension> loggerExtensions) { _loggerExtensions = loggerExtensions; _logger = CreateLogger(config); }
public AppLoggerSerilog(IAppLoggerConfig config) { _logger = CreateLogger(config); }