Exemplo n.º 1
0
        public HttpLogShipper(
            string serverUrl,
            string bufferBaseFilename,
            string apiKey,
            int batchPostingLimit,
            TimeSpan period,
            long?eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            HttpMessageHandler messageHandler,
            long?retainedInvalidPayloadsLimitBytes)
        {
            _apiKey              = apiKey;
            _batchPostingLimit   = batchPostingLimit;
            _eventBodyLimitBytes = eventBodyLimitBytes;
            _controlledSwitch    = new ControlledLevelSwitch(levelControlSwitch);
            _connectionSchedule  = new ExponentialBackoffConnectionSchedule(period);
            _retainedInvalidPayloadsLimitBytes = retainedInvalidPayloadsLimitBytes;
            _httpClient = messageHandler != null ?
                          new HttpClient(messageHandler) :
                          new HttpClient();
            _httpClient.BaseAddress = new Uri(SeqApi.NormalizeServerBaseAddress(serverUrl));

            _bookmarkFilename    = Path.GetFullPath(bufferBaseFilename + ".bookmark");
            _logFolder           = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(bufferBaseFilename) + "*.json";

            _timer = new PortableTimer(c => OnTick());

            SetTimer();
        }
Exemplo n.º 2
0
 public SeqSink(
     string serverUrl,
     string apiKey,
     int batchPostingLimit,
     TimeSpan period,
     long?eventBodyLimitBytes,
     LoggingLevelSwitch levelControlSwitch,
     HttpMessageHandler messageHandler)
     : base(batchPostingLimit, period)
 {
     if (serverUrl == null)
     {
         throw new ArgumentNullException(nameof(serverUrl));
     }
     _apiKey = apiKey;
     _eventBodyLimitBytes    = eventBodyLimitBytes;
     _controlledSwitch       = new ControlledLevelSwitch(levelControlSwitch);
     _httpClient             = messageHandler != null ? new HttpClient(messageHandler) : new HttpClient();
     _httpClient.BaseAddress = new Uri(SeqApi.NormalizeServerBaseAddress(serverUrl));
 }