diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-07-12 14:31:56 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-07-12 14:31:56 -0300 |
commit | a264941d619f1c03e11326fc606c719b8d43e052 (patch) | |
tree | 5b3576e650be13ac988620607d0ccac3b5fa90a2 /src/leap/gui/loggerwindow.py | |
parent | 5c22d5cc2af8693592670b1838a42511bdfeaf3c (diff) | |
parent | 0cc747fbe97b7015e51504949546b47e2b110a68 (diff) |
Merge remote-tracking branch 'ivan/feature/improve-loggerwindow-colors' into develop
Diffstat (limited to 'src/leap/gui/loggerwindow.py')
-rw-r--r-- | src/leap/gui/loggerwindow.py | 24 |
1 files changed, 18 insertions, 6 deletions
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): |