Adding Basic Logging Statements |
Top Previous Next |
JrDebugLogger was designed to let you add debug logging statements to your code in a syntax identical to normal output statements You may use both printf-style debug statements and stream io style debug statements. Some aliases are also defined to let you use the identifiers you prefer (short lowercase names or longer uppercase names);
Basic printf-style debug logging statements: dbprintf("This is a debugging message."); dbprintf("There are %d items.",count); The above statements could also be written as: JrPrintf("This is a debugging message."); JrPrintf("There are %d items.",count);
Basic stream io style debug logging statements: debugout << "This is a debugging message."; debugout << "There are "<<count<<" items."; Or alternatively: JrDebugStream << "This is a debugging message."; JrDebugStream << "There are "<<count<<" items.";
You can mix and match printf style and stream style output; sometimes printf style can be easier for unusual formatting requirements, but stream output is safer and is easier to use with arbitrary objects.
NOTE: The examples above show only the most basic use of debug logging statements; see the advanced section for more sophisticated ways to add information to your statements. |