コード例 #1
0
ファイル: SplunkViaHttpSink.cs プロジェクト: nslowes/serilog
 /// <summary>
 /// Creates a new instance of the splunk sink
 /// </summary>
 /// <param name="context">The Splunk Context</param>
 /// <param name="batchSizeLimit">The size of the batch prior to logging</param>
 /// <param name="batchInterval">The interval on which to log via http</param>
 /// <param name="formatProvider">The format provider to use when rendering the message</param>
 public SplunkViaHttpSink(
     SplunkContext context,
     int batchSizeLimit,
     TimeSpan batchInterval,
     IFormatProvider formatProvider = null)
     : this(context, context.Index, context.Username, context.Password, batchSizeLimit, batchInterval, context.ResourceNamespace, context.TransmitterArgs, formatProvider)
 {
 }
コード例 #2
0
 /// <summary>
 /// Creates a new instance of the splunk sink
 /// </summary>
 /// <param name="context">The Splunk Context</param>
 /// <param name="batchSizeLimit">The size of the batch prior to logging</param>
 /// <param name="batchInterval">The interval on which to log via http</param>
 /// <param name="formatProvider">The format provider to use when rendering the message</param>
 public SplunkViaHttpSink(
     SplunkContext context,
     int batchSizeLimit,
     TimeSpan batchInterval,
     IFormatProvider formatProvider = null)
     : this(context, context.Index, context.Username, context.Password, batchSizeLimit, batchInterval, context.ResourceNamespace, context.TransmitterArgs, formatProvider)
 {
 }
コード例 #3
0
        /// <summary>
        /// Adds a sink that writes log events as to a Splunk instance via http.
        /// </summary>
        /// <param name="loggerConfiguration">The logger configuration.</param>
        /// <param name="context">The Splunk context to log to</param>
        /// <param name="batchSizeLimit">The size of the batch prior to logging</param>
        /// <param name="batchInterval">The interval on which to log via http</param>
        /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <returns>Logger configuration, allowing configuration to continue.</returns>
        /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
        /// <remarks>TODO: Add link to splunk configuration and wiki</remarks>
        public static LoggerConfiguration SplunkViaHttp(
            this LoggerSinkConfiguration loggerConfiguration,
            SplunkContext context,
            int batchSizeLimit,
            TimeSpan batchInterval,
            LogEventLevel restrictedToMinimumLevel = LogEventLevel.Debug,
            IFormatProvider formatProvider = null)
        {
            var sink = new SplunkViaHttpSink(context, batchSizeLimit, batchInterval, formatProvider);

            return loggerConfiguration.Sink(sink);
        }
        /// <summary>
        /// Adds a sink that writes log events as to a Splunk instance via http.
        /// </summary>
        /// <param name="loggerConfiguration">The logger configuration.</param>
        /// <param name="context">The Splunk context to log to</param>
        /// <param name="batchInterval"></param>
        /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="batchSizeLimit">The size of the batch prior to writing</param>
        /// <param name="renderTemplate">If true, the message template will be rendered</param>
        /// <returns>Logger configuration, allowing configuration to continue.</returns>
        /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
        /// <remarks>TODO: Add link to splunk configuration and wiki</remarks>
        public static LoggerConfiguration SplunkViaHttp(
            this LoggerSinkConfiguration loggerConfiguration,
            SplunkContext context,
            int batchSizeLimit,
            TimeSpan batchInterval,
            LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
            IFormatProvider formatProvider = null,
             bool renderTemplate = true)
        {
            var sink = new SplunkViaHttpSink(context, batchSizeLimit, batchInterval, formatProvider, renderTemplate);

            return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
        }