tand/test/Tand.Core.Tests/LogTarget.cs

26 lines
608 B
C#
Raw Permalink Normal View History

2020-03-10 00:01:59 +00:00
using System;
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>
{
private readonly Action<T> _instanceHandle;
2020-03-10 00:01:59 +00:00
public LogTarget(Action<T> instanceHandle)
2020-03-10 00:01:59 +00:00
{
_instanceHandle = instanceHandle;
2020-03-10 00:01:59 +00:00
}
public void OnEnterMethod(CallEnterContext<T> enterContext)
{
_instanceHandle(enterContext.Instance);
2020-03-10 00:01:59 +00:00
}
public void OnLeaveMethod(CallLeaveContext<T> callLeaveContext)
{
_instanceHandle(callLeaveContext.Instance);
2020-03-10 00:01:59 +00:00
}
}
}