Simply3DScan
Log.cs
Go to the documentation of this file.
1 using System;
2 using System.Diagnostics;
3 using Logging;
4 using PostSharp.Aspects;
5 
6 namespace SharedObjects
7 {
8  [Serializable]
9  public class Log : OnMethodBoundaryAspect
10  {
17  public override void OnEntry(MethodExecutionArgs args)
18  {
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());
21  base.OnEntry(args);
22  }
23 
31  public override void OnExit(MethodExecutionArgs args)
32  {
33 
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());
36  base.OnExit(args);
37  }
38  }
39 }
Class for creating a singleton for a generic class
Definition: Singleton.cs:9
override void OnExit(MethodExecutionArgs args)
Method executed after the body of methods to which this aspect is applied, even when the method exist...
Definition: Log.cs:31
Definition: Logger.cs:5
static T Instance
Gets the instance.
Definition: Singleton.cs:27
override void OnEntry(MethodExecutionArgs args)
Method executed before the body of methods to which this aspect is applied.
Definition: Log.cs:17