All developers uses macro
, when debugging an application written in the Qt, but there are also macros
qInfo(), qWarning(), qCritical()
(which, as of this writing has errors and did not work).
With these events, you can divide errors in the application on the level of significance and use filters.
To redirect error messages to a text file, you need to install the
handler into the application. For this purpose
The signature handler must be as follows:
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
Through it, we will receive the following information:
- Message Type
- context of a message, the most useful of it - this is the message category. What is important when working with data output can be used, and additional categories, due to which it is possible to improve the localization of posts in the component of the program, if you used the same number of messages.
- message transmitted in error logging