diff --git a/ElasticLogging/LoggingService.cs b/ElasticLogging/LoggingService.cs index 3ae313b..aedaf6b 100644 --- a/ElasticLogging/LoggingService.cs +++ b/ElasticLogging/LoggingService.cs @@ -71,13 +71,19 @@ public async ValueTask DisposeAsync() public void Flush() { if (_pendingLogs.Any()) + { _elasticClient.IndexMany(_pendingLogs); + _pendingLogs.Clear(); + } } public async Task FlushAsync() { if (_pendingLogs.Any()) + { await _elasticClient.IndexManyAsync(_pendingLogs); + _pendingLogs.Clear(); + } } public void Fatal(Exception ex)