Skip to content

Commit

Permalink
Added clear to pending logs once indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaustin700 committed Jan 14, 2021
1 parent 0a0bd1d commit 9c5cd4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ElasticLogging/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c5cd4b

Please sign in to comment.