Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Local qMessageHandled and message pattern



  • Hello!
    I use Qt-5.12.6, can I set independent qMessageHandler and/or message pattern for different part of application, e.g. plugin will use message pattern %{time yyyyMMdd h:mm:ss.zzz} %{catery}, but application - {%file} %{function} %{line}?
    Thank you.



  • @debian
    I don't think so, as there is only one globally-installed message handler:
    https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler

    Only one message handler can be defined, since this is usually done on an application-wide basis to control debug output.

    You would need something in code in your handler which could (somehow) distinguish where you are being called from in code. Which is liable to be difficult....


Log in to reply