public HttpLogShipper(
            string bufferBaseFilename,
            int batchPostingLimit,
            TimeSpan period, long?
            eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            long?retainedInvalidPayloadsLimitBytes,
            Encoding encoding,
            int?retainedFileCountLimit)
        {
            _batchPostingLimit      = batchPostingLimit;
            _retainedFileCountLimit = retainedFileCountLimit;

            _controlledSwitch   = new ControlledLevelSwitch(levelControlSwitch);
            _connectionSchedule = new ExponentialBackoffConnectionSchedule(period);

            _logglyClient = new LogglyClient(); //we'll use the loggly client instead of HTTP directly

            //create necessary path elements
            var candidateSearchPath = Path.GetFileName(bufferBaseFilename) + "*.json";
            var logFolder           = Path.GetDirectoryName(candidateSearchPath);

            //Filebase is currently the only option available so we will stick with it directly (for now)
            var encodingToUse    = encoding;
            var bookmarkProvider = new FileBasedBookmarkProvider(bufferBaseFilename, _fileSystemAdapter, encoding);

            _bufferDataProvider   = new FileBufferDataProvider(bufferBaseFilename, _fileSystemAdapter, bookmarkProvider, encodingToUse, batchPostingLimit, eventBodyLimitBytes, retainedFileCountLimit);
            _invalidPayloadLogger = new InvalidPayloadLogger(logFolder, encodingToUse, _fileSystemAdapter, retainedInvalidPayloadsLimitBytes);

            _timer = new PortableTimer(c => OnTick());
            SetTimer();
        }
예제 #2
0
        public HttpLogShipper(
            string bufferBaseFilename,
            int batchPostingLimit,
            TimeSpan period,
            long?eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            long?retainedInvalidPayloadsLimitBytes,
            Encoding encoding)
        {
            _batchPostingLimit   = batchPostingLimit;
            _eventBodyLimitBytes = eventBodyLimitBytes;
            _controlledSwitch    = new ControlledLevelSwitch(levelControlSwitch);
            _connectionSchedule  = new ExponentialBackoffConnectionSchedule(period);
            _retainedInvalidPayloadsLimitBytes = retainedInvalidPayloadsLimitBytes;
            _encoding = encoding;

            _logglyClient = new LogglyClient(); //we'll use the loggly client instead of HTTP directly

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

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