×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Using isDebug() in driver to print debug messages

  • Posts: 86
  • Thank you received: 5
Hi there. I'm trying to debug my Indi driver but I've failed, so far, to get debug output. My CMake line is

CMake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug . ..

...and in the options tab for this driver under "INDI Control Panel - KStars" I've enabled Debug and ticked "Driver Debug" under both "Debug Levels" and "Logging Levels". My Connect() function, following the example of focus_simulator.cpp, contains this:

bool FocuserRob::Connect()
{
    IDMessage(getDeviceName(), "Rob Connected.");
 
    if (isDebug())
    {
        IDLog("Hello Debug");
    }
 
    return true;
}

...but all I get in the client log under "INDI Control Panel - KStars" is:

2016-04-03T21:43:56: Rob Connected.

What am I doing wrong?

Rob
Last edit: 8 years 2 weeks ago by Rob Meades. Reason: Point out that I'm using the example of focuser_simulator.cpp.
8 years 2 weeks ago #7566

Please Log in or Create an account to join the conversation.

  • Posts: 86
  • Thank you received: 5
[Answering my own question, sorry for bothering everyone]

Not sure what isDebug() is, maybe I started from the wrong example, but the correct way to debug a driver seems to be to put:

addDebugControl();

...in initProperties() and then use either:

DEBUG(INDI::Logger::DBG_SESSION, "Hello Debug");

...if you have no parameters or:

DEBUGF(INDI::Logger::DBG_SESSION, "Printf() style things like %d", aNumber);

...if you have parameters.

Rob
8 years 2 weeks ago #7567

Please Log in or Create an account to join the conversation.

isDebug() is just to know if the user enabled debug or not, it's not much used in current drivers. I'll write a chapter in the developers manual to cover this. It's already documented in the API but not the developers manual.
8 years 2 weeks ago #7569

Please Log in or Create an account to join the conversation.

Here is the Debugging and Logging documentation in the Developer's Manual. Please let me know if there is anything else that is not clear or obscure within the manual.
The following user(s) said Thank You: Rob Meades
8 years 2 weeks ago #7570

Please Log in or Create an account to join the conversation.

  • Posts: 86
  • Thank you received: 5
You don't hang about do you! :cheer: That's absolutely perfect, many thanks.

Rob
8 years 2 weeks ago #7571

Please Log in or Create an account to join the conversation.

Time to create page: 0.270 seconds