Visual Studio extension that add log call in the beginning and the end of selected function.
For example:
public void SomeFunction1()
{
for (int iCounter = 0; iCounter < 10; iCounter++)
{
Console.WriteLine(iCounter);
}
}
will be changed to
public void SomeFunction1()
{
prolog
for (int iCounter = 0; iCounter < 10; iCounter++)
{
Console.WriteLine(iCounter);
}
epilog
}
Please note that those two line prolog
and epilog
was dynamically inserted.
- Clone solution
- Compile and install VSix extension into Visual Studio
- Once extension installed just right mouse click inside a function and select
Add measure logs
You could change the text in prolog
and epilog
in Tools
-> Options
dialog:
text typed as {functionName}
will be replaced by actual function name at run time
- Visual Studio Extensibility Development book
- Most of the coded was borrowed from: mmahulea/FactonExtensionPackage. Thank you !
That's all
Please note that this is an example code - just to show how it is done. Don't expect too much from it. May be buggy
😉 👍