Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Commit 9b90b50

Browse files
committed
expose exception
1 parent 6cafc3e commit 9b90b50

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sample/Serilog.Sinks.Elasticsearch.Sample/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void Main(string[] args)
4242
NumberOfShards = 2,
4343
//BufferBaseFilename = "./buffer",
4444
// RegisterTemplateFailure = RegisterTemplateRecovery.FailSink,
45-
FailureCallback = e => Console.WriteLine("Unable to submit event " + e.MessageTemplate),
45+
FailureCallback = (ev, ex) => Console.WriteLine("Unable to submit event " + ev.MessageTemplate),
4646
EmitEventFailure = EmitEventFailureHandling.WriteToSelfLog |
4747
EmitEventFailureHandling.WriteToFailureSink |
4848
EmitEventFailureHandling.RaiseCallback,

src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchSink.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected virtual void HandleException(Exception ex, IEnumerable<LogEvent> event
139139
{
140140
foreach (var e in events)
141141
{
142-
_state.Options.FailureCallback(e);
142+
_state.Options.FailureCallback(e, ex);
143143
}
144144
}
145145
catch (Exception exCallback)
@@ -242,7 +242,7 @@ private void HandleResponse(IEnumerable<LogEvent> events, DynamicResponse result
242242
// Send to a failure callback
243243
try
244244
{
245-
_state.Options.FailureCallback(e);
245+
_state.Options.FailureCallback(e, null);
246246
}
247247
catch (Exception ex)
248248
{

src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public class ElasticsearchSinkOptions
246246
/// A callback which can be used to handle logevents which are not submitted to Elasticsearch
247247
/// like when it is unable to accept the events. This is optional and depends on the EmitEventFailure setting.
248248
/// </summary>
249-
public Action<LogEvent> FailureCallback { get; set; }
249+
public Action<LogEvent, Exception> FailureCallback { get; set; }
250250

251251
/// <summary>
252252
/// The maximum number of events that will be held in-memory while waiting to ship them to

0 commit comments

Comments
 (0)