Changeset 1164:92e6925b39b8


Ignore:
Timestamp:
06/05/24 18:56:35 (7 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Long debug logs are attached as a file to the bug tickets

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/gui.py

    r1163 r1164  
    6161                 ("Zsebényi-Loksa", "Gergely", "test") ]
    6262
     63    _maxInlineDebugLogLines = 200
     64
    6365    def __init__(self, programDirectory, config):
    6466        """Construct the GUI."""
     
    17691771            description += str(formatFlightLogLine(timestampString, text))
    17701772
     1773        buffer = self._debugLogView.get_buffer()
     1774        debugLogTooLong = buffer.get_line_count()>GUI._maxInlineDebugLogLines
     1775
    17711776        description += "\n\n" + ("=" * 40)
    1772         description += "\n\nThe contents of the debug log:\n\n"
    1773 
    1774         buffer = self._debugLogView.get_buffer()
    1775         description += buffer.get_text(buffer.get_start_iter(),
    1776                                        buffer.get_end_iter(), True)
     1777        description += "\n\nThe contents of the debug log%s:\n\n" % \
     1778            (" (truncated)" if debugLogTooLong else "")
     1779
     1780        debugLog = buffer.get_text(buffer.get_start_iter(),
     1781                                   buffer.get_end_iter(), True)
     1782        if debugLogTooLong:
     1783            description += buffer.get_text(buffer.get_start_iter(),
     1784                                           buffer.get_iter_at_line(GUI._maxInlineDebugLogLines),
     1785                                           True)
     1786        else:
     1787            description += debugLog
     1788            debugLog = None
    17771789
    17781790        self.beginBusy(xstr("sendBugReport_busy"))
    17791791        self._sendBugReportCallback = callback
    17801792        self.webHandler.sendBugReport(self._bugReportSentCallback,
    1781                                       summary, description, email)
     1793                                      summary, description, email,
     1794                                      debugLog = debugLog)
    17821795
    17831796    def _cefInitialized(self):
  • src/mlx/web.py

    r1154 r1164  
    2323import html.parser
    2424import certifi
     25import base64
    2526
    2627#---------------------------------------------------------------------------------------
     
    726727    _latin2Encoder = codecs.getencoder("iso-8859-2")
    727728
    728     def __init__(self, callback, summary, description, email):
     729    def __init__(self, callback, summary, description, email, debugLog):
    729730        """Construct the request for the given bug report."""
    730731        super(SendBugReport, self).__init__(callback)
     
    732733        self._description = description
    733734        self._email = email
     735        self._debugLog = debugLog
    734736
    735737    def run(self):
     
    747749                                                    attributes, True)
    748750        print("Created ticket with ID:", result.ticketID)
     751        if self._debugLog:
     752            serverProxy.ticket.putAttachment(result.ticketID, "debug.log",
     753                                             "Debug log",
     754                                             bytes(self._debugLog, "utf-8"))
     755
     756
    749757        result.success = True
    750758
     
    953961        self._addRequest(request)
    954962
    955     def sendBugReport(self, callback, summary, description, email):
     963    def sendBugReport(self, callback, summary, description, email, debugLog = None):
    956964        """Send a bug report with the given data."""
    957         self._addRequest(SendBugReport(callback, summary, description, email))
     965        self._addRequest(SendBugReport(callback, summary, description, email,
     966                                       debugLog = debugLog))
    958967
    959968    def setCheckFlightPassed(self, callback, aircraftType):
Note: See TracChangeset for help on using the changeset viewer.