public HttpLogShipper(
            string serverUrl,
            string bufferBaseFilename,
            string apiKey,
            int batchPostingLimit,
            TimeSpan period,
            long?eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            HttpMessageHandler messageHandler,
            long?retainedInvalidPayloadsLimitBytes,
            long?bufferSizeLimitBytes)
        {
            _apiKey              = apiKey;
            _batchPostingLimit   = batchPostingLimit;
            _eventBodyLimitBytes = eventBodyLimitBytes;
            _controlledSwitch    = new ControlledLevelSwitch(levelControlSwitch);
            _connectionSchedule  = new ExponentialBackoffConnectionSchedule(period);
            _retainedInvalidPayloadsLimitBytes = retainedInvalidPayloadsLimitBytes;
            _bufferSizeLimitBytes   = bufferSizeLimitBytes;
            _httpClient             = messageHandler != null ? new HttpClient(messageHandler) : new HttpClient();
            _httpClient.BaseAddress = new Uri(SeqApi.NormalizeServerBaseAddress(serverUrl));
            _fileSet = new FileSet(bufferBaseFilename);
            _timer   = new PortableTimer(c => OnTick());

            SetTimer();
        }
Esempio n. 2
0
 public SeqAuditSink(
     string serverUrl,
     string apiKey,
     HttpMessageHandler messageHandler,
     bool useCompactFormat)
 {
     if (serverUrl == null)
     {
         throw new ArgumentNullException(nameof(serverUrl));
     }
     _apiKey                 = apiKey;
     _useCompactFormat       = useCompactFormat;
     _httpClient             = messageHandler != null ? new HttpClient(messageHandler) : new HttpClient();
     _httpClient.BaseAddress = new Uri(SeqApi.NormalizeServerBaseAddress(serverUrl));
 }