title: Python/QT Live Application Log in QML
body: <p>I am trying to create a live log of all console output in the QML GUI.
  I want to emit a QT signal every time Python writes to stdout/stderr.  I am using Python 3.8. Here is my code that performs logging of QML output and Python interpreter stderr by writing to a file and the console.</p>
  <pre><code>class Log(QObject, object):
  
      def __init__(self):
          logging.basicConfig(
              level=logging.DEBUG,
              format=&quot;%(asctime)s [%(levelname)s] %(message)s&quot;,
              handlers=[
                  logging.FileHandler(&quot;debug.log&quot;, mode='w'),
                  logging.StreamHandler()
              ]
          )
          qInstallMessageHandler(self.qt_message_handler)
  
      def qt_message_handler(self, mode, context, message):
          log_entry = &quot;%s: %s (%s:%d, %s)&quot; % (mode.name.decode(), message, context.file, context.line, context.file)
          logging.warning(log_entry)
  </code></pre>