public static LoggerConfiguration LogzIoDurableHttp(
     this LoggerSinkConfiguration sinkConfiguration,
     string requestUri,
     string bufferPathFormat          = "Buffer-{Hour}.json",
     long?bufferFileSizeLimitBytes    = 104857600,
     bool bufferFileShared            = false,
     int?retainedBufferFileCountLimit = 31,
     int batchPostingLimit            = 1000,
     TimeSpan?period = null,
     LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose,
     IHttpClient?httpClient       = null,
     IConfiguration?configuration = null,
     LogzioTextFormatterOptions?logzioTextFormatterOptions = null)
 {
     return(sinkConfiguration.DurableHttpUsingTimeRolledBuffers(requestUri
                                                                , bufferPathFormat
                                                                , bufferFileSizeLimitBytes
                                                                , bufferFileShared
                                                                , retainedBufferFileCountLimit
                                                                , batchPostingLimit
                                                                , period
                                                                , new LogzIoTextFormatter(logzioTextFormatterOptions)
                                                                , new LogzIoBatchFormatter(renameRenderedMessageJsonNode: false)
                                                                , restrictedToMinimumLevel
                                                                , httpClient
                                                                , configuration
                                                                ));
 }
        /// <summary>
        /// Adds a durable sink that will send log events to Grafana Loki. A durable sink
        /// will persist log events on disk in buffer files before sending them over the
        /// network, thus protecting against data loss after a system or process restart. The
        /// buffer files will use a rolling behavior defined by the time interval specified in
        /// <paramref name="bufferPathFormat"/>, i.e. a new buffer file is created every time a new
        /// interval is started. The maximum size of a file is defined by
        /// <paramref name="bufferFileSizeLimitBytes"/>, and when that limit is reached all
        /// incoming log events will be dropped until a new interval is started.
        /// </summary>
        /// <param name="sinkConfiguration">
        /// The logger configuration.
        /// </param>
        /// <param name="uri">
        /// The root URI of Loki.
        /// </param>
        /// <param name="bufferPathFormat">
        /// The relative or absolute path format for a set of files that will be used to buffer
        /// events until they can be successfully sent over the network. Default value is
        /// "Buffer-{Date}.json". To use file rotation that is on an 30 or 60 minute interval pass
        /// "Buffer-{HalfHour}.json" or "Buffer-{Hour}.json".
        /// </param>
        /// <param name="bufferFileSizeLimitBytes">
        /// The approximate maximum size, in bytes, to which a buffer file for a specific time interval will be
        /// allowed to grow. By default no limit will be applied.
        /// </param>
        /// <param name="bufferFileShared">
        /// Allow the buffer file to be shared by multiple processes. Default value is false.
        /// </param>
        /// <param name="retainedBufferFileCountLimit">
        /// The maximum number of buffer files that will be retained, including the current buffer
        /// file. Under normal operation only 2 files will be kept, however if the log server is
        /// unreachable, the number of files specified by <paramref name="retainedBufferFileCountLimit"/>
        /// will be kept on the file system. For unlimited retention, pass null. Default value is 31.
        /// </param>
        /// <param name="labels">
        /// The globals log event labels, which will be user for enriching all requests.
        /// </param>
        /// <param name="excludedLabels">
        /// Keys, which would be excluded from a the label list in a payload.
        /// </param>
        /// <param name="credentials">
        /// Auth <see cref="LokiCredentials"/>.
        /// </param>
        /// <param name="outputTemplate">
        /// A message template describing the format used to write to the sink.
        /// Default value is <code>"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"</code>.
        /// </param>
        /// <param name="restrictedToMinimumLevel">
        /// The minimum level for events passed through the sink.
        /// Default value is <see cref="LevelAlias.Minimum"/>.
        /// </param>
        /// <param name="batchPostingLimit">
        /// The maximum number of events to post in a single batch. Default value is 1000.
        /// </param>
        /// <param name="queueLimit">
        /// The maximum number of events stored in the queue in memory, waiting to be posted over
        /// the network. Default value is infinitely.
        /// </param>
        /// <param name="period">
        /// The time to wait between checking for event batches. Default value is 2 seconds.
        /// </param>
        /// <param name="textFormatter">
        /// The formatter rendering individual log events into text, for example JSON. Default
        /// value is <see cref="MessageTemplateTextFormatter"/>.
        /// </param>
        /// <param name="httpClient">
        /// A custom <see cref="IHttpClient"/> implementation. Default value is
        /// <see cref="DefaultLokiHttpClient"/>.
        /// </param>
        /// <returns>Logger configuration, allowing configuration to continue.</returns>
        public static LoggerConfiguration DurableGrafanaLokiUsingTimeRolledBuffers(
            this LoggerSinkConfiguration sinkConfiguration,
            string uri,
            string bufferPathFormat                = "Buffer-{Date}.json",
            long?bufferFileSizeLimitBytes          = null,
            bool bufferFileShared                  = false,
            int?retainedBufferFileCountLimit       = 31,
            IEnumerable <LokiLabel> labels         = null,
            IEnumerable <string> excludedLabels    = null,
            LokiCredentials credentials            = null,
            string outputTemplate                  = DefaultOutputTemplate,
            LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
            int batchPostingLimit                  = 1000,
            int?queueLimit  = null,
            TimeSpan?period = null,
            ITextFormatter textFormatter = null,
            IHttpClient httpClient       = null)
        {
            if (sinkConfiguration == null)
            {
                throw new ArgumentNullException(nameof(sinkConfiguration));
            }

            var(batchFormatter, formatter, client) =
                SetupClientAndFormatters(labels, excludedLabels, textFormatter, outputTemplate, httpClient, credentials);

            return(sinkConfiguration.DurableHttpUsingTimeRolledBuffers(
                       LokiRoutesBuilder.BuildLogsEntriesRoute(uri),
                       bufferPathFormat,
                       bufferFileSizeLimitBytes,
                       bufferFileShared,
                       retainedBufferFileCountLimit,
                       batchPostingLimit,
                       period,
                       formatter,
                       batchFormatter,
                       restrictedToMinimumLevel,
                       client));
        }