Skip to content

Commit

Permalink
Timestamp feature implemented in main class
Browse files Browse the repository at this point in the history
  • Loading branch information
haniibrahim committed Oct 1, 2018
1 parent 5e4310a commit 5262e5b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions de/haniibrahim/seriallogger/SerialLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -256,10 +256,10 @@ protected Boolean doInBackground() {

@Override
protected void process(List<String> 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);
}
}

Expand Down

0 comments on commit 5262e5b

Please sign in to comment.