From 8e9cdc8ff143759e800eabb1c33fd6f8654ed987 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Fri, 20 Nov 2015 08:49:44 +0100 Subject: [PATCH] Logging updates Came over BM (from "general" channel), I slightly modified it. --- src/bitmessageqt/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index baf2dc84..5eb7632e 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1,3 +1,4 @@ +from debug import logger withMessagingMenu = False try: from gi.repository import MessagingMenu @@ -13,14 +14,14 @@ try: from PyQt4.QtNetwork import QLocalSocket, QLocalServer except Exception as err: - logger.error( 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).') - logger.error('Error message: ' + str(err)) + logmsg = 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).' + logger.critical(logmsg, exc_info=True) sys.exit() try: _encoding = QtGui.QApplication.UnicodeUTF8 except AttributeError: - logger.error('QtGui.QApplication.UnicodeUTF8 error: ' + str(err)) + logger.exception('QtGui.QApplication.UnicodeUTF8 error', exc_info=True) from addresses import * import shared @@ -52,7 +53,6 @@ import pickle import platform import textwrap import debug -from debug import logger import subprocess import datetime from helper_sql import * @@ -3231,7 +3231,7 @@ class MyForm(settingsmixin.SMainWindow): f.write(message) f.close() except Exception, e: - sys.stderr.write('Write error: '+ e) + logger.exception('Message not saved', exc_info=True) self.statusBar().showMessage(_translate("MainWindow", "Write error.")) # Send item on the Sent tab to trash