Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Logging
Forum Updated to NodeBB v4.3 + New Features

Logging

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 281 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MasterQM Offline
    MasterQM Offline
    MasterQ
    wrote on last edited by MasterQ
    #1

    Hi,

    I am playing around with logging in PySide6 and found some (for me weird) issues.

    1. qInfo is not implemented?
    2. calling qFatal
      2.1) passes QtWarningMessage as type to the message handler, prints correct msg
      2.2) calls message handler again with QtFatalMessage and correct msg
      2.3) but qFormatLogMessage then returns
      [A qFatal() call was made from Python code]

    my code:

    LogMessagePattern = ("%{time yyyy-MM-dd HH:mm:ss.zzz} [%{type}]"
                         + "%{if-debug} %{appname}.%{function}%{endif}"
                         + "%{if-warning}\033[93m %{endif}"
                         + "%{if-critical}\033[33m %{endif}"
                         + "%{if-fatal}\033[91m %{endif}"
                         + " : %{message}"
                         + "\033[39m")
    
        #qInfo()
        qWarning("Warnung")
        qCritical("Kritisch")
        qFatal("Fatal")
    

    what I get:

    2024-11-18 14:49:19.483 [warning]  : Warnung
    2024-11-18 14:49:19.483 [critical]  : Kritisch
    2024-11-18 14:49:19.483 [warning]  : Fatal
    2024-11-18 14:49:19.483 [fatal]  : [A qFatal() call was made from Python code]
    

    This might be a bug?

    and finally

    1. What does the qCWarning, qCDebug, ... do? The first parameter is an object. What object? I could not find a suitable documentation.

    Joachim

    sierdzioS 1 Reply Last reply
    0
    • MasterQM MasterQ

      Hi,

      I am playing around with logging in PySide6 and found some (for me weird) issues.

      1. qInfo is not implemented?
      2. calling qFatal
        2.1) passes QtWarningMessage as type to the message handler, prints correct msg
        2.2) calls message handler again with QtFatalMessage and correct msg
        2.3) but qFormatLogMessage then returns
        [A qFatal() call was made from Python code]

      my code:

      LogMessagePattern = ("%{time yyyy-MM-dd HH:mm:ss.zzz} [%{type}]"
                           + "%{if-debug} %{appname}.%{function}%{endif}"
                           + "%{if-warning}\033[93m %{endif}"
                           + "%{if-critical}\033[33m %{endif}"
                           + "%{if-fatal}\033[91m %{endif}"
                           + " : %{message}"
                           + "\033[39m")
      
          #qInfo()
          qWarning("Warnung")
          qCritical("Kritisch")
          qFatal("Fatal")
      

      what I get:

      2024-11-18 14:49:19.483 [warning]  : Warnung
      2024-11-18 14:49:19.483 [critical]  : Kritisch
      2024-11-18 14:49:19.483 [warning]  : Fatal
      2024-11-18 14:49:19.483 [fatal]  : [A qFatal() call was made from Python code]
      

      This might be a bug?

      and finally

      1. What does the qCWarning, qCDebug, ... do? The first parameter is an object. What object? I could not find a suitable documentation.

      Joachim

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by sierdzio
      #2

      @MasterQ said in Logging:

      What does the qCWarning, qCDebug, ... do? The first parameter is an object. What object? I could not find a suitable documentation.

      This is for categorized logging, more info here: https://doc.qt.io/qt-6/qloggingcategory.html. I don't know if it works with Python.

      (Z(:^

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved