Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Categorized logging from QML
Forum Updated to NodeBB v4.3 + New Features

Categorized logging from QML

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 4 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.
  • F Offline
    F Offline
    fonzi337
    wrote on last edited by
    #1

    Hello,

    I am interested in using the categorized logging functionality (http://qt-project.org/doc/qt-5/qloggingcategory.html#installFilter) from QML. After installing a message handler, I have noticed that messages logged from QML using console.log(), console.warn() and console.error() have their category set to "qml". "qml" is very general, especially in a large QML-based project. Ideally I would like to use the logging categories from QML that I have defined in C++ using Q_LOGGING_CATEGORY/Q_DECLARE_LOGGING_CATEGORY, something conceptually equivalent to

    console.log(MY_CATEGORY, "This is a message for the MY_CATEGORY category defined in C++)

    Is something like this possible? The documentation doesn't mention anything about QML. It would be really useful to have the log category filtering capabilities to be able to filter QML log messages too...

    1 Reply Last reply
    1
    • V Offline
      V Offline
      Vincent007
      wrote on last edited by
      #2

      wait for "Categorized logging in QML":http://www.qtdeveloperdays.com/europe/lightning-talks#B1

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fonzi337
        wrote on last edited by
        #3

        That sounds promising. Hopefully this Lightning Talk will be given at Qt Developer Days San Francisco.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          trollixx
          wrote on last edited by
          #4

          You can find Giuseppe's code "here":http://pastebin.com/9yYaA41u.

          Oleg

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            Code here https://github.com/dangelog/qmllogging :)

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            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