示例#1
0
 /// <summary>
 /// Creates an instance of the Splunk UDP Sink.
 /// </summary>
 /// <param name="connectionInfo">Connection info used for connecting against Splunk.</param>
 /// <param name="formatter">Custom formatter to use if you e.g. do not want to use the JsonFormatter.</param>
 public UdpSink(
     SplunkUdpSinkConnectionInfo connectionInfo,
     ITextFormatter formatter)
 {
     Connect(connectionInfo);
     _formatter = formatter;
 }
示例#2
0
 /// <summary>
 /// Creates an instance of the Splunk UDP Sink.
 /// </summary>
 /// <param name="connectionInfo">Connection info used for connecting against Splunk.</param>
 /// <param name="formatProvider">Optional format provider</param>
 /// <param name="renderTemplate">If true, the message template will be rendered</param>
 public UdpSink(
     SplunkUdpSinkConnectionInfo connectionInfo,
     IFormatProvider formatProvider = null,
     bool renderTemplate            = true)
 {
     Connect(connectionInfo);
     _formatter = CreateDefaultFormatter(formatProvider, renderTemplate);
 }
示例#3
0
 private void Connect(SplunkUdpSinkConnectionInfo connectionInfo)
 {
     _socket = new Socket(SocketType.Dgram, ProtocolType.Udp);
     _socket.Connect(connectionInfo.Host, connectionInfo.Port);
 }
示例#4
0
 /// <summary>
 /// Creates an instance of the Splunk UDP Sink.
 /// </summary>
 /// <param name="connectionInfo">Connection info used for connecting against Splunk.</param>
 /// <param name="formatter">Custom formatter to use if you e.g. do not want to use the JsonFormatter.</param>
 public UdpSink(SplunkUdpSinkConnectionInfo connectionInfo, ITextFormatter formatter)
 {
     _connectionInfo = connectionInfo;
     _formatter      = formatter;
     Connect();
 }