Hi John,
I would like to be able to provide some logging functionality for some code
that I have written. Basically, in a development release of the software,
I would like to be able to log function calls, return values, variable
assignments, UI control events, object instantiations, etc. Basically I
would like a log file that represents the state of the executing code as it
is executing. This is very useful for finding bugs, especially in release
builds. Now, I was wondering if I could use an aspect to perform the
logging. The aspect would have to know what to log and it would need to
access method/variable/object metadata (what is the variable name, for
example).
With the logging aspect enabled, the following code
DoSomething(int i)
{
i = i + 1;
}
executes as this:
DoSomething(int i)
{
AspectLog("DoSomething(int i) => DoSomething(8)");
i = i + 1;
AspectLog("DoSomething var i = i + 1 => i = 8 + 1");
}
So, I thought that I could write something that would insert the log lines
into the source code, and then run the compiler which would generate the
executable with the logging functionality enabled. Is there a way to do
the same thing, but using aspects? Has anyone else done this yet?
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.