/// <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; }
/// <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); }
private void Connect(SplunkUdpSinkConnectionInfo connectionInfo) { _socket = new Socket(SocketType.Dgram, ProtocolType.Udp); _socket.Connect(connectionInfo.Host, connectionInfo.Port); }
/// <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(); }