public event NotifyCollectionChangedEventHandler LogEntriesChanged (#355)

This commit is contained in:
Stef Heyenrath
2019-10-08 09:50:59 +02:00
committed by GitHub
parent 3cc361e216
commit b2167f85ae
2 changed files with 47 additions and 1 deletions

View File

@@ -19,7 +19,21 @@ namespace WireMock.Server
[PublicAPI]
public event NotifyCollectionChangedEventHandler LogEntriesChanged
{
add => _options.LogEntries.CollectionChanged += value;
add
{
_options.LogEntries.CollectionChanged += (sender, eventRecordArgs) =>
{
try
{
value(sender, eventRecordArgs);
}
catch (Exception exception)
{
_options.Logger.Error("Error calling the LogEntriesChanged event handler: {0}", exception.Message);
}
};
}
remove => _options.LogEntries.CollectionChanged -= value;
}