gotelem/py/pytelem/gui_log.py

21 lines
377 B
Python
Raw Normal View History

2023-09-19 19:17:22 +00:00
import sys
import logging
from PySide6.QtCore import QObject, Slot, Signal
from PySide6.QtWidgets import QPlainTextEdit
class Bridge(QObject):
log = Signal(str)
class QLogHandler(logging.Handler):
bridge = Bridge()
def __init__(self):
super().__init__()
def emit(self, record):
msg = self.format(record)
self.bridge.log.emit(msg)