Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created February 14, 2012 21:50
Show Gist options
  • Select an option

  • Save mgroves/1830804 to your computer and use it in GitHub Desktop.

Select an option

Save mgroves/1830804 to your computer and use it in GitHub Desktop.
Simple trace aspect in PostSharp
[Serializable]
public class TraceAttribute : OnMethodBoundaryAspect
{
public override void OnEntry(MethodExecutionEventArgs args)
{
Trace.TraceInformation("Entering {0}.", args.Method);
}
public override void OnExit(MethodExecutionEventArgs args)
{
Trace.TraceInformation("Leaving {0}.", args.Method);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment