summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-07-12 14:31:56 -0300
committerTomás Touceda <chiiph@leap.se>2013-07-12 14:31:56 -0300
commita264941d619f1c03e11326fc606c719b8d43e052 (patch)
tree5b3576e650be13ac988620607d0ccac3b5fa90a2
parent5c22d5cc2af8693592670b1838a42511bdfeaf3c (diff)
parent0cc747fbe97b7015e51504949546b47e2b110a68 (diff)
Merge remote-tracking branch 'ivan/feature/improve-loggerwindow-colors' into develop
-rw-r--r--changes/bug_donnot_log_userdata1
-rw-r--r--changes/feature_improve-loggerwindow-colors1
-rw-r--r--src/leap/crypto/srpregister.py1
-rw-r--r--src/leap/gui/loggerwindow.py24
-rw-r--r--src/leap/util/leap_log_handler.py17
5 files changed, 21 insertions, 23 deletions
diff --git a/changes/bug_donnot_log_userdata b/changes/bug_donnot_log_userdata
new file mode 100644
index 00000000..855115b9
--- /dev/null
+++ b/changes/bug_donnot_log_userdata
@@ -0,0 +1 @@
+ o Do not log user data on registration. Fixes #3168. \ No newline at end of file
diff --git a/changes/feature_improve-loggerwindow-colors b/changes/feature_improve-loggerwindow-colors
new file mode 100644
index 00000000..fe03e877
--- /dev/null
+++ b/changes/feature_improve-loggerwindow-colors
@@ -0,0 +1 @@
+ o Improve LoggerWindow colors for easier debugging.
diff --git a/src/leap/crypto/srpregister.py b/src/leap/crypto/srpregister.py
index 42a2c4b0..24f73504 100644
--- a/src/leap/crypto/srpregister.py
+++ b/src/leap/crypto/srpregister.py
@@ -123,7 +123,6 @@ class SRPRegister(QtCore.QObject):
logger.debug('Post to uri: %s' % uri)
logger.debug("Will try to register user = %s" % (username,))
- logger.debug("user_data => %r" % (user_data,))
ok = None
try:
diff --git a/src/leap/gui/loggerwindow.py b/src/leap/gui/loggerwindow.py
index 4d24a7d8..fcbdbf19 100644
--- a/src/leap/gui/loggerwindow.py
+++ b/src/leap/gui/loggerwindow.py
@@ -76,11 +76,23 @@ class LoggerWindow(QtGui.QDialog):
the record contains the LogRecord of the logging module,
the message contains the formatted message for the log.
"""
- level = log[LeapLogHandler.RECORD_KEY].levelname
+ html_style = {
+ logging.DEBUG: "background: #CDFFFF;",
+ logging.INFO: "background: white;",
+ logging.WARNING: "background: #FFFF66;",
+ logging.ERROR: "background: red; color: white;",
+ logging.CRITICAL: "background: red; color: white; font: bold;"
+ }
+ level = log[LeapLogHandler.RECORD_KEY].levelno
message = log[LeapLogHandler.MESSAGE_KEY]
message = message.replace('\n', '<br>\n')
if self._logs_to_display[level]:
+ open_tag = "<tr style='" + html_style[level] + "'>"
+ open_tag += "<td width='100%' style='padding: 5px;'>"
+ close_tag = "</td></tr>"
+ message = open_tag + message + close_tag
+
self.ui.txtLogHistory.append(message)
def _load_history(self):
@@ -99,11 +111,11 @@ class LoggerWindow(QtGui.QDialog):
Sets the logs_to_display dict getting the toggled options from the ui
"""
self._logs_to_display = {
- 'DEBUG': self.ui.btnDebug.isChecked(),
- 'INFO': self.ui.btnInfo.isChecked(),
- 'WARNING': self.ui.btnWarning.isChecked(),
- 'ERROR': self.ui.btnError.isChecked(),
- 'CRITICAL': self.ui.btnCritical.isChecked()
+ logging.DEBUG: self.ui.btnDebug.isChecked(),
+ logging.INFO: self.ui.btnInfo.isChecked(),
+ logging.WARNING: self.ui.btnWarning.isChecked(),
+ logging.ERROR: self.ui.btnError.isChecked(),
+ logging.CRITICAL: self.ui.btnCritical.isChecked()
}
def _save_log_to_file(self):
diff --git a/src/leap/util/leap_log_handler.py b/src/leap/util/leap_log_handler.py
index 271096d3..9adb21a5 100644
--- a/src/leap/util/leap_log_handler.py
+++ b/src/leap/util/leap_log_handler.py
@@ -52,22 +52,7 @@ class LogHandler(logging.Handler):
:param logging_level: the debug level to define the color.
:type logging_level: str.
"""
- html_style = {
- 'DEBUG': "color: blue",
- 'INFO': "color: black",
- 'WARNING': "color: black; background: yellow;",
- 'ERROR': "color: red",
- 'CRITICAL': "color: red; font-weight: bold;"
- }
-
- style_open = "<span style='" + html_style[logging_level] + "'>"
- style_close = "</span>"
- time = "%(asctime)s"
- name = style_open + "%(name)s"
- level = "%(levelname)s"
- message = "%(message)s" + style_close
- format_attrs = [time, name, level, message]
- log_format = ' - '.join(format_attrs)
+ log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
formatter = logging.Formatter(log_format)
return formatter