public void Send(GelfMessage message) { using (var udpClient = new UdpClient()) foreach (var bytes in encoder.Encode(messageSerializer.Serialize(message))) { var result = udpClient.SendAsync(bytes, bytes.Length, configuration.Host).Result; } }
public void Send(GelfMessage message) { using (var udpClient = new UdpClient()) foreach (var bytes in encoder.Encode(messageSerializer.Serialize(message))) { udpClient.Send(bytes, bytes.Length, configuration.GetHost()); } }
public void Send(GelfMessage message) { EstablishConnection(); using (var stream = client.GetStream()) { var bytes = messageSerializer.Serialize(message); stream.Write(bytes, 0, bytes.Length); stream.WriteByte(0); } }
public void Send(GelfMessage message) { EstablishConnection(); var serialzed = messageSerializer.Serialize(message); var encoded = encoder.Encode(serialzed); foreach (var bytes in encoded) { udpClient.Send(bytes, bytes.Length); } }
public void Send(GelfMessage message) { EstablishConnection(); foreach (var bytes in encoder.Encode(messageSerializer.Serialize(message))) { var basicProperties = new BasicProperties { DeliveryMode = configuration.Persistent ? (byte)2 : (byte)1 }; channel.BasicPublish(configuration.Exchange, configuration.RoutingKey, false, false, basicProperties, bytes); } }
public void Send(GelfMessage message) { EstablishConnection(); var bytes = messageSerializer.Serialize(message); try { connection.Stream.Write(bytes, 0, bytes.Length); connection.Stream.WriteByte(0); } catch (Exception) { Close(); throw; } }
public void Send(GelfMessage message) { var request = (HttpWebRequest)WebRequest.Create(configuration.Uri); using (var requestStream = request.GetRequestStream()) using (var messageStream = new MemoryStream(messageSerializer.Serialize(message))) messageStream.CopyTo(requestStream); request.Method = "POST"; request.AllowAutoRedirect = false; request.ReadWriteTimeout = request.Timeout = configuration.Timeout; using (var response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.Accepted) { return; } throw new SendFailedException(); } }