Show launch time in crash logs.

This commit is contained in:
Alexander Cogneau 2015-08-07 20:36:38 +02:00
parent 5f122759db
commit 73c28c12f3
2 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import time
import shutil
import tempfile
import atexit
import datetime
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow
@ -712,6 +713,8 @@ class Application(QApplication):
objreg.register('args', args)
objreg.register('app', self)
self.launch_time = datetime.datetime.now()
def __repr__(self):
return utils.get_repr(self)

View File

@ -29,7 +29,7 @@ import pkg_resources
from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QVBoxLayout, QHBoxLayout, QCheckBox,
QDialogButtonBox, QMessageBox)
QDialogButtonBox, QMessageBox, QApplication)
import qutebrowser
from qutebrowser.utils import version, log, utils, objreg, qtutils
@ -219,6 +219,10 @@ class _CrashDialog(QDialog):
cmdhist: A list with the command history (as strings)
exc: An exception tuple (type, value, traceback)
"""
try:
self._crash_info.append(('Launch time', QApplication.instance().launch_time.strftime("%d-%m-%Y %H:%M:%S")))
except Exception:
self._crash_info.append(("Launch time", traceback.format_exc()))
try:
self._crash_info.append(("Version info", version.version()))
except Exception: