I'm new to the Qt/QML topic and I'm trying to install a logging handler in my c++ business logic. The following code snipet installs a handler and sets a special category:
int main(int argc, char *argv[])
{
qInstallMessageHandler(myMessageOutput);
QLoggingCategory mainEx("main.ex");
qCDebug(mainEx) << "debug message";
...
}
The result is a call from the Qt backend to the following installed message handler:
void myMessageOutput(QtMsgType type, const QMessageLogContext &context,
const QString &msg)
{
...
}
In Qt 5 it is also possible to write debug messages directly in in QML with:
console.debug("debug message")
But the 'cateory' in QMessageLogConext is always 'qml'. Is it possible to set another category directly in QML?