From 5b725be6ecf63e2c58a69cac6447bb4b7cab6fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96ster?= Date: Sun, 10 Nov 2019 16:10:45 +0100 Subject: [PATCH] Fixed two issues regarding BufferCleanPayload I fixed a logical test issue that made the code to not go through the cleanup path when errors happened and a issue with the error message where a ToString was called on a dictionary resulting in the type name instead of the actual error message. I refrained from adding the detailed errors provided by elastic, because they can be many and ridiculously detailed --- .../Durable/Elasticsearch/ElasticsearchLogClient.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/Durable/Elasticsearch/ElasticsearchLogClient.cs b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/Durable/Elasticsearch/ElasticsearchLogClient.cs index 2fc6b14b..8c6a74af 100644 --- a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/Durable/Elasticsearch/ElasticsearchLogClient.cs +++ b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/Durable/Elasticsearch/ElasticsearchLogClient.cs @@ -46,7 +46,7 @@ public async Task SendPayloadAsync(List payload, bool { var cleanPayload = new List(); var invalidPayload = GetInvalidPayloadAsync(response, payload, out cleanPayload); - if ((cleanPayload?.Any() == false) && first) + if ((cleanPayload?.Any() ?? false) && first) { await SendPayloadAsync(cleanPayload, false); } @@ -96,20 +96,22 @@ private InvalidResult GetInvalidPayloadAsync(DynamicResponse baseResult, List