Categorized logging from QML
-
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...
-
wait for "Categorized logging in QML":http://www.qtdeveloperdays.com/europe/lightning-talks#B1
-
That sounds promising. Hopefully this Lightning Talk will be given at Qt Developer Days San Francisco.
-
You can find Giuseppe's code "here":http://pastebin.com/9yYaA41u.
-
Code here https://github.com/dangelog/qmllogging :)