Debug Messages
Debug messages are designed to be turned on at a specified debug level
and are always sent to STDOUT
. There are designed to only be used in
the development debug process. They are coded as:
DmsgN(level, message, arg1, ...)
where the N is a number indicating how many arguments are to be
substituted into the message (i.e. it is a count of the number arguments
you have in your message – generally the number of percent signs (%)).
level is the debug level at which you wish the message to be
printed. message is the debug message to be printed, and arg1, … are the
arguments to be substituted. Since not all compilers support
#defines
with varargs, you must explicitly specify how many
arguments you have.
When the debug message is printed, it will automatically be prefixed by the name of the daemon which is running, the filename where the Dmsg is, and the line number within the file.
Some actual examples are:
Dmsg2(20, "MD5len=\%d MD5=\%s\n", strlen(buf), buf);
Dmsg1(9, "Created client \%s record\n", client->hdr.name);
Possible Next Steps
Go back to Message Classes.
Go back to Developer Notes.
Go back to Developer Guide.