RATIS-472. Clean up output for `read` logservice shell command
authorJosh Elser <elserj@apache.org>
Wed, 9 Jan 2019 19:57:41 +0000 (14:57 -0500)
committerJosh Elser <josh.elser@gmail.com>
Mon, 28 Jan 2019 19:32:35 +0000 (14:32 -0500)
ratis-logservice/src/main/java/org/apache/ratis/logservice/shell/commands/ReadLogCommand.java

index a1d4c74..ce5c954 100644 (file)
@@ -47,17 +47,17 @@ public class ReadLogCommand implements Command {
       long firstId = stream.getStartRecordId();
       long lastId = stream.getLastRecordId();
       StringBuilder sb = new StringBuilder();
-      int i = 0;
       List<ByteBuffer> records = reader.readBulk((int) (lastId - firstId));
       for (ByteBuffer record : records) {
         if (sb.length() > 0) {
           sb.append(", ");
         }
-        sb.append(i).append(":");
+        sb.append("\"");
         if (record != null) {
           String strData = new String(record.array(), record.arrayOffset(), record.remaining(), StandardCharsets.UTF_8);
           sb.append(strData);
         }
+        sb.append("\"");
       }
       sb.insert(0, "[");
       sb.append("]");