Activities |
Top Previous Next |
JrDebugLogger uses the concept of "Activities" to help you indicate what your program is currently doing when it sends debug logging messsages.
You can specify a specific "current activity" along with any message you send, but you can push and pop activities to help you keep track of recursive operations and blocks of operations without manually specifying activities:
JrDebugSetActivity(const char *inactivity,bool announce); JrDebugActivityPush(const char *inactivity,bool announce); JrDebugActivityPop(const char *dummyp=NULL,bool announce);
An example: JrDebugActivityPush("Looping"); for (int count=0;count<10;++count) { JrDebugActivityPush("InnerLooping"); for (int count2=0;count2<10;++count2) dbprintf("Performing iteration %d,%d",count,count2); JrDebugActivityPop("InnerLooping"); } JrDebugActivityPop("Looping");
In this example, each iteration of the loop will have the activity "Looping.InnerLooping".
When announce is true, the change of activity will be reported in the log.
Activities can also be used for timing activities; any time an activity finishes, ie a PopActivity is logged (announce==true), the log will describe how long the activity took.
|