Example #1
0
        public void Intercept(IInvocation invocation)
        {
            //Prior-invocation
            appender.Debug("Invoking {0}", GetMethodInformation(invocation));

            try
            {
                invocation.Proceed();
                //Post-invocation
                appender.Debug("{0} has finished. Returned {1}", invocation.Method.Name, invocation.ReturnValue);
            }
            catch (Exception ex)
            {
                //On exception
                appender.Error("Threw exception {0} . {1} ", ex.Message, GetMethodInformation(invocation));
                throw ex;
            }
        }
Example #2
0
        public void Intercept(IInvocation invocation)
        {
            //prior invocation
            auditor.Debug("Calling {0}", GetMethodInformation(invocation));

            try
            {
                invocation.Proceed();

                //post invocation
                auditor.Debug("Done: result was {0}.", invocation.ReturnValue);
            }
            catch (Exception ex)
            {
                //on exception
                auditor.Error("Threw exception {0} . {1} ", ex.Message, GetMethodInformation(invocation));
                throw ex;
            }
        }