public SeriLogElasticsearchConfig(ILoggerSource source) { if (source != null) { _config = new Settings(source as SerilogElasticsearchSource); _logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.Sink(new ElasticsearchSink(new ElasticsearchSinkOptions(new Uri(_config.Url)) { AutoRegisterTemplate = true, IndexDecider = (e, o) => _config.SearchIndex, })) .CreateLogger(); } else { _logger = new LoggerConfiguration().CreateLogger(); } }
public static void SetTestableInstance(ILoggerSource loggerSource) { _instance = loggerSource; }