Tracing methods execution time
I am trying to "inject" custom tracing methods in my application. I want to make it as elegant as possible, without modifying to much of the existing code, and have the possibility to enable / disable it easily. One solution i could think of would be to create a custom Attribute which i will attach it to the methods i want to trace. Basic idea: public class MethodSnifferAttribute : Attribute { private Stopwatch sw = null; public void BeforeExecution() { sw = new Stopwatch(); sw.Start(); } public void ExecutionEnd() { sw.Stop(); LoggerManager.Logger.Log("Execution time: " + sw