public void Intercept(Castle.DynamicProxy.IInvocation invocation) { var method = invocation.GetConcreteMethod(); method = invocation.InvocationTarget.GetType(). GetMethod(method.Name); if (method != null) { var attribute = method.GetCustomAttribute <MyTimerAttribute>(); try { if (attribute != null) { var sw = new Stopwatch(); sw.Start(); Console.WriteLine("Starting the log in Timer Interceptor"); invocation.Proceed(); sw.Stop(); Console.WriteLine($"Ending the log, ellapsed: {sw.ElapsedMilliseconds} ms"); } else { invocation.Proceed(); } } catch (Exception ex) { Console.WriteLine($"Exception occurred in method: {invocation.Method.Name}: {ex.Message} "); } } }