Skip to content

Instantly share code, notes, and snippets.

@floydpink
Created December 17, 2012 04:03
Show Gist options
  • Save floydpink/4315686 to your computer and use it in GitHub Desktop.
Save floydpink/4315686 to your computer and use it in GitHub Desktop.
The main method that does the AOP magic
public void Intercept(IInvocation invocation)
{
if (Log.IsDebugEnabled) Log.Debug(CreateInvocationLogString("Called", invocation));
try
{
invocation.Proceed();
if (Log.IsDebugEnabled)
if (invocation.Method.ReturnType != typeof(void))
Log.Debug("Returning with: " + invocation.ReturnValue);
}
catch (Exception ex)
{
if (Log.IsErrorEnabled) Log.Error(CreateInvocationLogString("ERROR", invocation), ex);
throw;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment