How to log all frames in a call stack for a console based application?
I am aware of this code:
StackTrace stackTrace = new StackTrace(); StackFrame stackFrames = stackTrace.GetFrames(); stackFrame.GetMethod().Name;
But I want to log all the methods that are being executed and log the start of the function and end of the function.
We have lots of files and methods and with a minimal change i wish to log the start & end of functions without touching the actual methods.
If we can write seperate interface and just a statement in the main function it would be of great help.
Any suggestions would be appreciated.
You should look into Aspect Oriented Programming (AOP). There's an implementation available in Spring.NET. Please google "Spring.NET AOP".— Manfred
AOP lets you inject code into methods via configuration with before and after options etc. !
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)