2020-03-10 00:01:59 +00:00
|
|
|
using System;
|
2020-03-21 00:10:20 +00:00
|
|
|
using Tand.Core.Api;
|
2020-03-10 00:01:59 +00:00
|
|
|
using Tand.Core.Models;
|
|
|
|
|
|
|
|
namespace Tand.Core.Tests
|
|
|
|
{
|
|
|
|
public class LogTarget<T> : ITandTarget<T>
|
|
|
|
{
|
2020-03-10 20:53:04 +00:00
|
|
|
private readonly Action<T> _instanceHandle;
|
2020-03-10 00:01:59 +00:00
|
|
|
|
2020-03-10 20:53:04 +00:00
|
|
|
public LogTarget(Action<T> instanceHandle)
|
2020-03-10 00:01:59 +00:00
|
|
|
{
|
2020-03-10 20:53:04 +00:00
|
|
|
_instanceHandle = instanceHandle;
|
2020-03-10 00:01:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void OnEnterMethod(CallEnterContext<T> enterContext)
|
|
|
|
{
|
2020-03-10 20:53:04 +00:00
|
|
|
_instanceHandle(enterContext.Instance);
|
2020-03-10 00:01:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void OnLeaveMethod(CallLeaveContext<T> callLeaveContext)
|
|
|
|
{
|
2020-03-10 20:53:04 +00:00
|
|
|
_instanceHandle(callLeaveContext.Instance);
|
2020-03-10 00:01:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|