0

我有一个用于我使用的服务的定时拦截器:

class TimingInterceptor : IInterceptor
{
    public void Intercept(IInvocation invocation)
    {                  
        var watch = new Stopwatch();
        watch.Start();
        try
        {
            invocation.Proceed();
        }
        finally
        {
            watch.Stop();

            PosLogFactory.Default.Verbose(
                 "{0} ms spent on calling {1}"
               , watch.Elapsed.TotalMilliseconds
               , invocation.Method.Name
               );
        }
    }

我使用这个拦截器来获取有关我的服务调用持续时间的日志信息。

我只想在从应用程序的某个部分调用服务时拥有它。当从特定类调用服务时,是否有暂停拦截器日志的选项?

4

1 回答 1

0

不,没有内置的方法可以做这样的事情。

于 2012-10-08T05:41:58.953 回答