Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Showcase
  4. Enhanced QDebug class set
Forum Updated to NodeBB v4.3 + New Features

Enhanced QDebug class set

Scheduled Pinned Locked Moved Showcase
4 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    u19809
    wrote on last edited by
    #1

    Hi all,

    Have you all also been annoyed by the fact that QDebug does not allow for fine grained module based logging ? And that you cannot set it on or on the fly ?

    Well I created a template based 2-file enhancement on top of regular QDebug (hence supporting all features of QDebug) allowing for all of the above. Here briefly what you can do

    first you need to include the new debug header file
    @
    #include <apdebug.h>
    @
    You need to declare each 'module' you wish to control to the system. This can be done in one of two
    @
    // if you have a class that 'controls' the module (the controlling class must be accessible to each other class
    // that wants to log using the same debug module (class header must be included
    static Debugging<ClassThatIsSpecificToThisModule> Debugging( "StringNameIdentifyingThisClass" );
    // or if you do not have a class
    int DebugFlag = false;
    static StaticDebugging StaticDebugging( "SomeName for the non-class related module", &DebugFlag );

    // next you can use a new version of qDebug (APDebug) like
    APDebug<ClassThatIsSpecificToThisModule>() << ... // regulare qDebug arguments
    // or for non class related modules
    StaticDebug( DebugFlag ) << ...
    @

    to list the debug state of all known modules
    @
    foreach( const QString & Mod, DebuggingAbstract::moduleList() ) {
    qDebug() << "Module" << Mod << "debug" << DebuggingAbstract::debugIsEnabled(Mod);
    }
    @
    controlling the state of debugging is done using
    @
    // enable disable all known modules
    DebuggingAbstract::enableDebug( true );
    // enable disable specific module
    DebuggingAbstract::enableDebug( "ModuleName", false ); // or true to enable
    @
    I would like to provide this code snippet to the community and offer it for scrutiny and enhancements.
    Just tell me where ...

    Greetz

    Edit: I put your code sections between @ tags for you; Andre

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Hi, thanks for this. Please wrap your code in '@' tags.

      You can push your code to github like everybody does :)

      (Z(:^

      1 Reply Last reply
      0
      • U Offline
        U Offline
        u19809
        wrote on last edited by
        #3

        Hmm sorry but I am an subversion users and not git ... any howto I could read on that.

        about that @ tags ... how does that work ?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Put your code between two '@' signs, like this:
          @
          // This is a code inside a comment block
          void main() {}
          @

          Well, it's your choice. You loose a lot in life by not using git. But there are plenty of public SVN servers, too: sourceforge, Google code, etc.

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved