DEBUGMSG
From Net-SNMP Wiki
If you want to add Debugging output statements to your own code, you can use the following conventions:
DEBUGMSGTL
DEBUGMSGTL(("token", "statement of some kind: %s\n", "with printf arguments"));
This actually outputs two lines:
- A "trace" line showing where in the source it came from (that's what the T stands for)
- Your debugging line (when -Dtoken is turned on)
This should be the most common debugging statement used. It should be used for complete debugging lines.
DEBUG
For creating lines a piece at a time, start with DEBUGMSGTL followed by DEBUGMSG macros until you hit the newline ("\n"). This is a stupid example but shows how it works:
int total = 0; DEBUGMSGTL(("token", "Calculating something: ")); for(int i = 0; i < 5; i++) { total = total + i;