4 using PostSharp.Aspects;
9 public class Log : OnMethodBoundaryAspect
17 public override void OnEntry(MethodExecutionArgs args)
19 StackFrame frame =
new StackFrame(1,
true);
20 Singleton<Logger>.
Instance.LogInfo(String.Format(
"Starting {0}", args.Method), frame.GetMethod().Name, frame.GetFileName(), frame.GetFileLineNumber());
31 public override void OnExit(MethodExecutionArgs args)
34 StackFrame frame =
new StackFrame(1,
true);
35 Singleton<Logger>.
Instance.LogInfo(String.Format(
"Exit {0}", args.Method), frame.GetMethod().Name, frame.GetFileName(), frame.GetFileLineNumber());
Class for creating a singleton for a generic class
override void OnExit(MethodExecutionArgs args)
Method executed after the body of methods to which this aspect is applied, even when the method exist...
static T Instance
Gets the instance.
override void OnEntry(MethodExecutionArgs args)
Method executed before the body of methods to which this aspect is applied.