From 5262e5bb2939402ef7e9299e6a2d0dd5cbe15bf2 Mon Sep 17 00:00:00 2001 From: Hani Andreas Ibrahim Date: Mon, 1 Oct 2018 16:37:36 +0200 Subject: [PATCH] Timestamp feature implemented in main class --- de/haniibrahim/seriallogger/SerialLogger.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/de/haniibrahim/seriallogger/SerialLogger.java b/de/haniibrahim/seriallogger/SerialLogger.java index 19577ca..1354311 100644 --- a/de/haniibrahim/seriallogger/SerialLogger.java +++ b/de/haniibrahim/seriallogger/SerialLogger.java @@ -231,7 +231,7 @@ protected Boolean doInBackground() { while (((line = serialBufferedReader.readLine()) != null) && !isCancelled()) { publish(line); if (logFlag) { - pw.println(line); // save to buffer (file) + pw.println(getTimestamp() + line); // save to buffer (file) pw.flush(); // flush buffer and tries to save every line to the file immediately } } @@ -256,10 +256,10 @@ protected Boolean doInBackground() { @Override protected void process(List chunk) { - - for (String line : chunk) { - ta_LogPanel.append(line + "\n"); - System.out.println(line); + String timestamp; + for (String line : chunk) { + ta_LogPanel.append(getTimestamp() + line + "\n"); + System.out.println(getTimestamp() + line); } }