Пример #1
0
        public DurableSeqSink(
            string serverUrl,
            string bufferBaseFilename,
            string apiKey,
            int batchPostingLimit,
            TimeSpan period,
            long?bufferSizeLimitBytes,
            long?eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            HttpMessageHandler messageHandler,
            long?retainedInvalidPayloadsLimitBytes)
        {
            if (serverUrl == null)
            {
                throw new ArgumentNullException(nameof(serverUrl));
            }
            if (bufferBaseFilename == null)
            {
                throw new ArgumentNullException(nameof(bufferBaseFilename));
            }


            _shipper = new HttpLogShipper(
                serverUrl,
                bufferBaseFilename,
                apiKey,
                batchPostingLimit,
                period,
                eventBodyLimitBytes,
                levelControlSwitch,
                messageHandler,
                retainedInvalidPayloadsLimitBytes,
                bufferSizeLimitBytes);

            const long individualFileSizeLimitBytes = 100L * 1024 * 1024;

            _sink = new LoggerConfiguration()
                    .MinimumLevel.Verbose()
                    .WriteTo.File(new RawJsonFormatter(),
                                  bufferBaseFilename + "-.json",
                                  rollingInterval: RollingInterval.Day,
                                  fileSizeLimitBytes: individualFileSizeLimitBytes,
                                  rollOnFileSizeLimit: true,
                                  retainedFileCountLimit: null,
                                  encoding: Encoding.UTF8)
                    .CreateLogger();
        }
Пример #2
0
        public DurableSeqSink(
            string serverUrl,
            string bufferBaseFilename,
            string?apiKey,
            int batchPostingLimit,
            TimeSpan period,
            long?bufferSizeLimitBytes,
            long?eventBodyLimitBytes,
            ControlledLevelSwitch controlledSwitch,
            HttpMessageHandler?messageHandler,
            long?retainedInvalidPayloadsLimitBytes)
        {
            if (serverUrl == null)
            {
                throw new ArgumentNullException(nameof(serverUrl));
            }
            if (bufferBaseFilename == null)
            {
                throw new ArgumentNullException(nameof(bufferBaseFilename));
            }

            var fileSet = new FileSet(bufferBaseFilename);

            _shipper = new HttpLogShipper(
                fileSet,
                new SeqIngestionApiClient(serverUrl, apiKey, messageHandler),
                batchPostingLimit,
                period,
                eventBodyLimitBytes,
                controlledSwitch,
                retainedInvalidPayloadsLimitBytes,
                bufferSizeLimitBytes);

            const long individualFileSizeLimitBytes = 100L * 1024 * 1024;

            _sink = new LoggerConfiguration()
                    .MinimumLevel.Verbose()
                    .WriteTo.File(new ConstrainedBufferedFormatter(eventBodyLimitBytes),
                                  fileSet.RollingFilePathFormat,
                                  rollingInterval: RollingInterval.Day,
                                  fileSizeLimitBytes: individualFileSizeLimitBytes,
                                  rollOnFileSizeLimit: true,
                                  retainedFileCountLimit: null,
                                  encoding: Encoding.UTF8)
                    .CreateLogger();
        }
        public DurableSeqSink(
            string serverUrl,
            string bufferBaseFilename,
            string apiKey,
            int batchPostingLimit,
            TimeSpan period,
            long?bufferFileSizeLimitBytes,
            long?eventBodyLimitBytes,
            LoggingLevelSwitch levelControlSwitch,
            HttpMessageHandler messageHandler,
            long?retainedInvalidPayloadsLimitBytes)
        {
            if (serverUrl == null)
            {
                throw new ArgumentNullException(nameof(serverUrl));
            }
            if (bufferBaseFilename == null)
            {
                throw new ArgumentNullException(nameof(bufferBaseFilename));
            }

            _shipper = new HttpLogShipper(
                serverUrl,
                bufferBaseFilename,
                apiKey,
                batchPostingLimit,
                period,
                eventBodyLimitBytes,
                levelControlSwitch,
                messageHandler,
                retainedInvalidPayloadsLimitBytes);

            _sink = new RollingFileSink(
                bufferBaseFilename + "-{Date}.json",
                new RawJsonFormatter(),
                bufferFileSizeLimitBytes,
                null,
                encoding: Encoding.UTF8);
        }