code_junkie

Insert Function Name during PreBuild

Nov 12th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Class SampleClass
  2. {
  3. public void FunctionA()
  4. {
  5. try
  6. {
  7. //Do some work here
  8. }
  9. catch (Exception ex)
  10. {
  11. Logger.WriteLine(LogLevelEnum.Error, "SampleClass", "FunctionA Failed");
  12. Logger.WriteLine(LogLevelEnum.Error, "FunctionA", ex.ToString());
  13. }
  14. finally
  15. {
  16. }
  17. }
  18. }
  19.  
  20. public class SimplestTraceAttribute : OnMethodBoundaryAspect
  21. {
  22. public override void OnEntry( MethodExecutionEventArgs eventArgs)
  23. {
  24. Trace.TraceInformation("Entering {0}.", eventArgs.Method);
  25. Trace.Indent();
  26. }
  27. public override void OnExit( MethodExecutionEventArgs eventArgs)
  28. {
  29. Trace.Unindent();
  30. Trace.TraceInformation("Leaving {0}.", eventArgs.Method);
  31. }
  32. }
Add Comment
Please, Sign In to add comment