-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete IAsyncLogEventSinkMonitor impl
- Loading branch information
Showing
8 changed files
with
92 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
src/Serilog.Sinks.Async/Sinks/Async/IAsyncLogEventSinkMonitor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
namespace Serilog.Sinks.Async | ||
{ | ||
/// <summary> | ||
/// Defines a mechanism for the Async Sink to provide buffer metadata to facilitate integration into system health checking. | ||
/// Defines a mechanism for the Async Sink to afford Health Checks a buffer metadata inspection mechanism. | ||
/// </summary> | ||
/// <remarks>If the instance implements <see cref="System.IDisposable"/>, it will be <c>Dispose()</c>d at then time the Sink is.</remarks> | ||
public interface IAsyncLogEventSinkMonitor | ||
{ | ||
/// <summary> | ||
/// Invoked by Sink to supply the buffer state hook to the monitor. | ||
/// Invoked by Sink to supply the inspector to the monitor. | ||
/// </summary> | ||
/// <param name="state">The Async Sink's state information interface.</param> | ||
void MonitorState(IAsyncLogEventSinkState state); | ||
/// <param name="inspector">The Async Sink's inspector.</param> | ||
void StartMonitoring(IAsyncLogEventSinkInspector inspector); | ||
|
||
/// <summary> | ||
/// Invoked by Sink to indicate that it is being Disposed. | ||
/// </summary> | ||
/// <param name="inspector">The Async Sink's inspector.</param> | ||
void StopMonitoring(IAsyncLogEventSinkInspector inspector); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Serilog.Sinks.Async.Tests.Support | ||
{ | ||
class DummyMonitor : IAsyncLogEventSinkMonitor | ||
{ | ||
IAsyncLogEventSinkInspector inspector; | ||
public IAsyncLogEventSinkInspector Inspector => inspector; | ||
|
||
void IAsyncLogEventSinkMonitor.StartMonitoring(IAsyncLogEventSinkInspector inspector) => | ||
this.inspector = inspector; | ||
|
||
void IAsyncLogEventSinkMonitor.StopMonitoring(IAsyncLogEventSinkInspector inspector) => | ||
System.Threading.Interlocked.CompareExchange(ref this.inspector, null, inspector); | ||
} | ||
} |