0

I have a timing interceptor for the services I use:

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
               );
        }
    }

And I use this interceptor to get log information about the duration of my services calls.

I only want to have it when the services are called from a certain part of the application. Is there an option to suspend interceptor logs, when the services are called from a specific class?

Angela_SB
  • 249
  • 4
  • 12
  • I don't believe there's anything built in to DynamicProxy to do that. You'd have to write it yourself inside the interceptor. – PatrickSteele Sep 26 '12 at 18:57

1 Answers1

0

No, there's no built in way to do anything like this.

Krzysztof Kozmic
  • 27,267
  • 12
  • 73
  • 115