/// <summary> /// Initializes a new instance of the <see cref="FileSizeRolledDurableHttpSink"/> class. /// </summary> public FileSizeRolledDurableHttpSink( string requestUri, string bufferBaseFileName, long?bufferFileSizeLimitBytes, int?retainedBufferFileCountLimit, int batchPostingLimit, TimeSpan period, ITextFormatter textFormatter, IBatchFormatter batchFormatter, IHttpClient client) { if (bufferFileSizeLimitBytes.HasValue && bufferFileSizeLimitBytes < 0) { throw new ArgumentOutOfRangeException(nameof(bufferFileSizeLimitBytes), "Negative value provided; file size limit must be non-negative."); } shipper = new HttpLogShipper( client, requestUri, new FileSizeRolledBufferFiles(new DirectoryService(), bufferBaseFileName), batchPostingLimit, period, batchFormatter); sink = new LoggerConfiguration() .WriteTo.File( textFormatter, $"{bufferBaseFileName}-.json", fileSizeLimitBytes: bufferFileSizeLimitBytes, rollOnFileSizeLimit: true, retainedFileCountLimit: retainedBufferFileCountLimit, rollingInterval: RollingInterval.Day, encoding: Encoding.UTF8) .CreateLogger(); }
/// <summary> /// Initializes a new instance of the <see cref="DurableHttpSink"/> class. /// </summary> public DurableHttpSink( string requestUri, string bufferPathFormat, long?bufferFileSizeLimitBytes, int?retainedBufferFileCountLimit, int batchPostingLimit, TimeSpan period, ITextFormatter textFormatter, IBatchFormatter batchFormatter, IHttpClient client) { if (bufferFileSizeLimitBytes.HasValue && bufferFileSizeLimitBytes < 0) { throw new ArgumentOutOfRangeException(nameof(bufferFileSizeLimitBytes), "Negative value provided; file size limit must be non-negative."); } shipper = new HttpLogShipper( client, requestUri, bufferPathFormat, batchPostingLimit, period, batchFormatter); sink = new RollingFileSink( bufferPathFormat, textFormatter, bufferFileSizeLimitBytes, retainedBufferFileCountLimit, Encoding.UTF8); }
public DurableKinesisFirehoseSink(KinesisFirehoseSinkOptions options, IAmazonKinesisFirehose kinesisFirehoseClient) { var state = new KinesisSinkState(options, kinesisFirehoseClient); if (string.IsNullOrWhiteSpace(options.BufferBaseFilename)) { throw new ArgumentException("Cannot create the durable Amazon Kinesis Firehose sink without a buffer base file name."); } _sink = new RollingFileSink( options.BufferBaseFilename + "-{Date}.json", state.DurableFormatter, options.BufferFileSizeLimitBytes, null); _shipper = new HttpLogShipper(state); if (options.OnLogSendError != null) { _shipper.LogSendError += options.OnLogSendError; } }