コード例 #1
0
ファイル: SplunkViaTcpSink.cs プロジェクト: BugBusted/serilog
        /// <summary>
        /// Creates an instance of the Splunk TCP Sink
        /// </summary>
        /// <param name="hostAddress">The Splunk Host</param>
        /// <param name="port">The UDP port configured in Splunk</param>
        /// <param name="formatProvider">Optional format provider</param>
        public SplunkViaTcpSink(
            IPAddress hostAddress,
            int port,
            IFormatProvider formatProvider = null)
        {
            var reconnectionPolicy = new ExponentialBackoffTcpReconnectionPolicy();

            _writer = new TcpSocketWriter(hostAddress, port, reconnectionPolicy, 10000);

            _jsonFormatter = new JsonFormatter(renderMessage: true, formatProvider: formatProvider);
        }
コード例 #2
0
        /// <summary>
        /// Creates an instance of the Splunk TCP Sink
        /// </summary>
        /// <param name="hostAddress">The Splunk Host</param>
        /// <param name="port">The UDP port configured in Splunk</param>
        /// <param name="formatProvider">Optional format provider</param>
        /// <param name="renderTemplate">If true, the message template will be rendered</param>
        public TcpSink(
            IPAddress hostAddress,
            int port,
            IFormatProvider formatProvider = null,
            bool renderTemplate = true)
        {
            var reconnectionPolicy = new ExponentialBackoffTcpReconnectionPolicy();

            _writer = new TcpSocketWriter(hostAddress, port, reconnectionPolicy, 10000);

            _jsonFormatter = new SplunkJsonFormatter(renderMessage: true, formatProvider: formatProvider, renderTemplate: renderTemplate);
        }