summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-09-10 16:05:44 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-09-10 16:05:44 -0300
commitb0cc3f3096db324a9e4106556b5c5718d5e1c2b5 (patch)
treeb0ea1f8868d912da076541cb465cb876e71fc2c4
parent4255d5753a6ad74dc09692dc8fea980edf9d8204 (diff)
Fix LoggerWindow saving triple \n. Closes #3714.
-rw-r--r--changes/bug-3714_fix-logger-saving-several-line-returns2
-rw-r--r--src/leap/bitmask/gui/loggerwindow.py10
2 files changed, 9 insertions, 3 deletions
diff --git a/changes/bug-3714_fix-logger-saving-several-line-returns b/changes/bug-3714_fix-logger-saving-several-line-returns
new file mode 100644
index 00000000..455c5a95
--- /dev/null
+++ b/changes/bug-3714_fix-logger-saving-several-line-returns
@@ -0,0 +1,2 @@
+ o Fix LoggerWindow saving more than one line return per line in the logs
+ file. Closes #3714.
diff --git a/src/leap/bitmask/gui/loggerwindow.py b/src/leap/bitmask/gui/loggerwindow.py
index ece4cad6..ad2ceded 100644
--- a/src/leap/bitmask/gui/loggerwindow.py
+++ b/src/leap/bitmask/gui/loggerwindow.py
@@ -91,7 +91,6 @@ class LoggerWindow(QtGui.QDialog):
}
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] + "'>"
@@ -152,8 +151,13 @@ class LoggerWindow(QtGui.QDialog):
if fileName:
try:
with open(fileName, 'w') as output:
- output.write(self.ui.txtLogHistory.toPlainText())
- output.write('\n')
+ history = self.ui.txtLogHistory.toPlainText()
+ # Chop some \n.
+ # html->plain adds several \n because the html is made
+ # using table cells.
+ history = history.replace('\n\n\n', '\n')
+
+ output.write(history)
logger.debug('Log saved in %s' % (fileName, ))
except IOError, e:
logger.error("Error saving log file: %r" % (e, ))