[PyQt] PyQt5/Android: print/log messages
Kálmán Viktor
viktorvector at gmail.com
Sat Apr 25 00:30:50 BST 2020
You can add it like this, not sure if this would help. (maybe wrap the
whole thing in an if that checks if you are on android or not)
class QtHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self.qt_message_logger = QMessageLogger()
def emit(self, record):
record = self.format(record)
# I think you can get log level from the record and use the correct
method of qt_message_logger based on that
self.qt_message_logger.debug(record.encode("utf-8"))
qtHandler = QtHandler()
logger = logging.getLogger(__name__)
logger.addHandler(qtHandler)
(forgot to include the list previously)
Rodrigo Oliveira <rodrigo.oliveira at byne.com.br> ezt írta (időpont: 2020.
ápr. 20., H, 5:12):
> Hi, I'm porting an existing application to Android. It's already working,
> but can't manage to print/log messages on logcat (Qt 5.12.3 (arm64_v8a),
> PyQt 5.12.3, sip 4.19.18 and pyqtdeploy 2.5.1).
>
> I can use 'console.log' from QML, but print and logging from python
> doesn't show on adb logcat.
> Also, tried qDebug, but the application crashes (QtCore is listed both on
> sysroot.json and on the pdy file.
>
> Anyone experimented or know how to solve this? Am I missing something?
>
> Many thanks,
> Rodrigo Oliveira
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200425/bbc886ce/attachment-0001.htm>
More information about the PyQt
mailing list