private static ElasticsearchChannelOptions <LogEvent> CreateChannelOptions(ElasticsearchLoggerOptions options, IChannelSetup[] channelConfigurations) { var channelOptions = new ElasticsearchChannelOptions <LogEvent> { Index = options.Index, IndexOffset = options.IndexOffset, ConnectionPoolType = options.ShipTo.ConnectionPoolType, WriteEvent = async(stream, ctx, logEvent) => await logEvent.SerializeAsync(stream, ctx).ConfigureAwait(false), TimestampLookup = l => l.Timestamp }; if (options.ShipTo.ConnectionPoolType == ConnectionPoolType.Cloud || options.ShipTo.ConnectionPoolType == ConnectionPoolType.Unknown && !string.IsNullOrEmpty(options.ShipTo.CloudId)) { channelOptions.ShipTo = !string.IsNullOrWhiteSpace(options.ShipTo.Username) ? new ShipTo(options.ShipTo.CloudId, options.ShipTo.Username, options.ShipTo.Password) : new ShipTo(options.ShipTo.CloudId, options.ShipTo.ApiKey); } else { channelOptions.ShipTo = new ShipTo(options.ShipTo.NodeUris, options.ShipTo.ConnectionPoolType); } foreach (var channelSetup in channelConfigurations) { channelSetup.ConfigureChannel(channelOptions); } return(channelOptions); }
private void ReloadLoggerOptions(ElasticsearchLoggerOptions options) { _shipper.Options = options; foreach (var logger in _loggers) { logger.Value.Options = options; } }
private void ReloadLoggerOptions(ElasticsearchLoggerOptions options) { var channelOptions = CreateChannelOptions(options, _channelConfigurations); _shipper.Options = channelOptions; foreach (var logger in _loggers) { logger.Value.Options = options; } }
internal ElasticsearchLogger( string categoryName, ElasticsearchChannel <LogEvent> channel, ElasticsearchLoggerOptions options, IExternalScopeProvider?scopeProvider ) { _categoryName = categoryName; _channel = channel; _options = options; _scopeProvider = scopeProvider; }
private void ReloadLoggerOptions(ElasticsearchLoggerOptions options) => _shipper.Options = CreateChannelOptions(options, _channelConfigurations);