I want to develop indented trace for our large C++ code base that will be perticularly helpful for developers to find the issues. I want to have indented trace functionality. E.g Consider following code:-
void FunctionA()
{
TR_ENTER("Function A");
TR_PRINT("Dignostic message Function A");
FunctionB(); // Call function B
}
void FunctionB()
{
TR_ENTER("Function B");
TR_PRINT("Dignostic message Function B");
FunctionC(); // Call function B
}
void FunctionC()
{
TR_ENTER("Function C");
TR_PRINT("Dignostic message Function C");
}
As you can see the calls above are nested within each other. I want to generate trace log as shown below:
Function A - Start
Dignostic message Function A
Function B - Start
Dignostic message Function B
Function C - Start
Dignostic message Function C
Function C - End
Function B - End
Function A - End
TR_ENTER and TR_PRINT are some macros that I have use as example. To say that the function start I have use TR_ENTER and for printing some dignostic messages I have used TR_PRINT.
As you can see traces for nested function call are indented within each other. May I know is there anything already available so that I could prevent myself to work on reinventing the wheel.
Thanks, Omky