Observable logs (#51)

* observable log entries

* event test
This commit is contained in:
deeptowncitizen
2017-10-07 09:05:02 -04:00
committed by Stef Heyenrath
parent 9c55ff5ea6
commit 2d39a18b70
4 changed files with 87 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using JetBrains.Annotations;
using WireMock.Logging;
using WireMock.Matchers.Request;
@@ -11,6 +12,28 @@ namespace WireMock.Server
{
public partial class FluentMockServer
{
/// <summary>
/// Log entries notification handler
/// </summary>
[PublicAPI]
public event NotifyCollectionChangedEventHandler LogEntriesChanged
{
add
{
lock (((ICollection) _options.LogEntries).SyncRoot)
{
_options.LogEntries.CollectionChanged += value;
}
}
remove
{
lock (((ICollection)_options.LogEntries).SyncRoot)
{
_options.LogEntries.CollectionChanged -= value;
}
}
}
/// <summary>
/// Gets the request logs.
/// </summary>