public ElasticsearchLoggerProvider(IOptionsMonitor <ElasticsearchLoggerOptions> options)
 {
     _options = options;
     _shipper = new ElasticsearchChannel <LogEvent>(options.CurrentValue);
     _loggers = new ConcurrentDictionary <string, ElasticsearchLogger>();
     ReloadLoggerOptions(options.CurrentValue);
     _optionsReloadToken = _options.OnChange(ReloadLoggerOptions);
 }
Exemple #2
0
 internal ElasticsearchLogger(
     string categoryName,
     ElasticsearchChannel <LogEvent> channel,
     ElasticsearchLoggerOptions options,
     IExternalScopeProvider?scopeProvider
     )
 {
     _categoryName  = categoryName;
     _channel       = channel;
     _options       = options;
     _scopeProvider = scopeProvider;
 }
        public ElasticsearchLoggerProvider(IOptionsMonitor <ElasticsearchLoggerOptions> options,
                                           IEnumerable <IChannelSetup> channelConfigurations
                                           )
        {
            _options = options;
            _channelConfigurations = channelConfigurations.ToArray();

            var channelOptions = CreateChannelOptions(options.CurrentValue, _channelConfigurations);

            _shipper = new ElasticsearchChannel <LogEvent>(channelOptions);

            _loggers = new ConcurrentDictionary <string, ElasticsearchLogger>();
            ReloadLoggerOptions(options.CurrentValue);
            _optionsReloadToken = _options.OnChange(ReloadLoggerOptions);
        }
Exemple #4
0
        public ElasticsearchLoggerProvider(IOptionsMonitor <ElasticsearchLoggerOptions> options,
                                           IEnumerable <IChannelSetup> channelConfigurations
                                           )
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            if (channelConfigurations is null)
            {
                throw new ArgumentNullException(nameof(channelConfigurations));
            }

            _channelConfigurations = channelConfigurations.ToArray();

            var channelOptions = CreateChannelOptions(options.CurrentValue, _channelConfigurations);

            _shipper = new ElasticsearchChannel <LogEvent>(channelOptions);

            ReloadLoggerOptions(options.CurrentValue);
            _optionsReloadToken = _options.OnChange(o => ReloadLoggerOptions(o));
        }
Exemple #5
0
 public TestSession(ITransport <ITransportConfiguration> transport)
 {
     Transport     = transport;
     BufferOptions = new BufferOptions <Base>()
     {
         ConcurrentConsumers       = 1,
         MaxConsumerBufferSize     = 2,
         MaxConsumerBufferLifetime = TimeSpan.FromSeconds(10),
         WaitHandle                    = WaitHandle,
         MaxRetries                    = 3,
         BackoffPeriod                 = times => TimeSpan.FromMilliseconds(1),
         ServerRejectionCallback       = (list) => Interlocked.Increment(ref _rejections),
         BulkAttemptCallback           = (c, a) => Interlocked.Increment(ref _requests),
         ElasticsearchResponseCallback = (r, b) => Interlocked.Increment(ref _responses),
         MaxRetriesExceededCallback    = (list) => Interlocked.Increment(ref _maxRetriesExceeded),
         RetryCallBack                 = (list) => Interlocked.Increment(ref _retries),
         ExceptionCallback             = (e) => LastException = e
     };
     ChannelOptions = new ElasticsearchChannelOptions <Base>(transport)
     {
         BufferOptions = BufferOptions
     };
     Channel = new ElasticsearchChannel <Base>(ChannelOptions);
 }
Exemple #6
0
 internal ElasticsearchLogger(string categoryName, ElasticsearchChannel <LogEvent> channel)
 {
     _categoryName = categoryName;
     _channel      = channel;
 }