I have now tried to use the new debug handler API in hamlib but without any success. Some time ago, Stephane added some code to hamlib, which allows frontend programs to register their own debug handler, which then will be called every time a debug message is sent. The API uses the same parameter structure as the old hamlib API meaning that the handler will receive the comlete variable argument list that was originally sent to the rig_debug function.
I admit that I’m no expert in the field of variable argument lists in C, but trying to mimic exactly what the rig_debug function does gives me no success at all. It is like the data coming down from hamlib gets corrupted along the way. If I try to print to stderr or a file, everything is ok. Only when I try to get the debug messages back to my own debug handler in grig, do I run into trouble.
After playing around some more I came to the conclusion that it does not work. I base this conclusion on the fact that everything works all right if I use a simple, flat gchar * parameter instead of the variable argument list. I have sent an email to the hamlib-developer mailing list asking for clarification and/or confirmation of my observations.