Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68753

qDebug(category) << "Input"; will fail when QT_NO_DEBUG_OUTPUT is defined

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.4
    • Core: Other
    • None

    Description

      I have declared a category for QMessageLogger:

       

      Q_DECLARE_LOGGING_CATEGORY(network)
      

      To print messages like this one:

       

      qDebug(network) << "UDP port" << port << "ready.";
      

      If I switch to Release mode which defines QT_NO_DEBUG_OUTPUT so disables qDebug all qDebug() messages disappears but code will not compile in lines where category is used:

      error: no matching function for call to 'QMessageLogger::noDebug(const QLoggingCategory& (&)())'
      qDebug(network) << UDP port" << port << "ready.";
      

      I think additional function should be declared in qlogging.h.
      Now:

      QNoDebug noDebug() const Q_DECL_NOTHROW;
      

      Add to correct the problem (I did not checked it it is working):

      QNoDebug noDebug() const Q_DECL_NOTHROW;
      QNoDebug noDebug(const QLoggingCategory &cat) const Q_DECL_NOTHROW;
      (...)

       

       

       

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            killdaclick Maciej Andrzejewski
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes