public async Task SendMessageAsync(GelfMessage message)
        {
            var content = new StringContent(message.ToJson(), Encoding.UTF8, "application/json");
            var result  = await _httpClient.PostAsync("gelf", content).ConfigureAwait(false);

            result.EnsureSuccessStatusCode();
        }
Exemplo n.º 2
0
        public async Task SendMessageAsync(GelfMessage message)
        {
            var messageBytes = Encoding.UTF8.GetBytes(message.ToJson());

            if (_options.CompressUdp && messageBytes.Length > _options.UdpCompressionThreshold)
            {
                messageBytes = await CompressMessageAsync(messageBytes);
            }

            foreach (var messageChunk in ChunkMessage(messageBytes))
            {
                await _udpClient.SendAsync(messageChunk, messageChunk.Length, _options.Host, _options.Port);
            }
        }