PEL: Align peltool list output values

Start using the jsonInsert() function when printing the peltool list
output, so it will automatically align the JSON key values:

Before:
{
	"0x50000001": {
		"SRC": "1100A013",
		"Message": "A config file error occurred",
		"PLID": "0x50000001",
		"CreatorID": "BMC",
		"Subsystem": "Power/Cooling Subsystem",
		"Commit Time": "05/24/2021 21:10:27",
		"Sev": "Unrecoverable Error",
 		"CompID": "0x2700"
 	}
}

After:
{
    "0x50000001": {
        "SRC":                  "1100A013",
        "Message":              "A config file error occurred",
        "PLID":                 "0x50000001",
        "CreatorID":            "BMC",
        "Subsystem":            "Power/Cooling Subsystem",
        "Commit Time":          "05/24/2021 21:10:27",
        "Sev":                  "Unrecoverable Error",
        "CompID":               "0x2700"
    }
}

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I8b6636c9d865f1d8acee0976102d15903be47190
diff --git a/extensions/openpower-pels/tools/peltool.cpp b/extensions/openpower-pels/tools/peltool.cpp
index 7d0842f..fe3afac 100644
--- a/extensions/openpower-pels/tools/peltool.cpp
+++ b/extensions/openpower-pels/tools/peltool.cpp
@@ -352,41 +352,45 @@
         else
         {
             // id
-            listStr += "\t\"" +
+            listStr += "    \"" +
                        getNumberString("0x%X", pel.privateHeader().id()) +
                        "\": {\n";
             // ASCII
             if (pel.primarySRC())
             {
                 val = pel.primarySRC().value()->asciiString();
-                listStr += "\t\t\"SRC\": \"" + trimEnd(val) + "\",\n";
+                jsonInsert(listStr, "SRC", trimEnd(val), 2);
+
                 // Registry message
                 auto regVal = pel.primarySRC().value()->getErrorDetails(
                     registry, DetailLevel::message, true);
                 if (regVal)
                 {
                     val = regVal.value();
-                    listStr += "\t\t\"Message\": \"" + val + "\",\n";
+                    jsonInsert(listStr, "Message", val, 2);
                 }
             }
             else
             {
-                listStr += "\t\t\"SRC\": \"No SRC\",\n";
+                jsonInsert(listStr, "SRC", "No SRC", 2);
             }
+
             // platformid
-            listStr += "\t\t\"PLID\": \"" +
-                       getNumberString("0x%X", pel.privateHeader().plid()) +
-                       "\",\n";
+            jsonInsert(listStr, "PLID",
+                       getNumberString("0x%X", pel.privateHeader().plid()), 2);
+
             // creatorid
             std::string creatorID =
                 getNumberString("%c", pel.privateHeader().creatorID());
             val = pv::creatorIDs.count(creatorID) ? pv::creatorIDs.at(creatorID)
                                                   : "Unknown Creator ID";
-            listStr += "\t\t\"CreatorID\": \"" + val + "\",\n";
-            // subsytem
+            jsonInsert(listStr, "CreatorID", val, 2);
+
+            // subsystem
             std::string subsystem = pv::getValue(pel.userHeader().subsystem(),
                                                  pel_values::subsystemValues);
-            listStr += "\t\t\"Subsystem\": \"" + subsystem + "\",\n";
+            jsonInsert(listStr, "Subsystem", subsystem, 2);
+
             // commit time
             sprintf(tmpValStr, "%02X/%02X/%02X%02X %02X:%02X:%02X",
                     pel.privateHeader().commitTimestamp().month,
@@ -396,22 +400,24 @@
                     pel.privateHeader().commitTimestamp().hour,
                     pel.privateHeader().commitTimestamp().minutes,
                     pel.privateHeader().commitTimestamp().seconds);
-            val = std::string(tmpValStr);
-            listStr += "\t\t\"Commit Time\": \"" + val + "\",\n";
+            jsonInsert(listStr, "Commit Time", tmpValStr, 2);
+
             // severity
             std::string severity = pv::getValue(pel.userHeader().severity(),
                                                 pel_values::severityValues);
-            listStr += "\t\t\"Sev\": \"" + severity + "\",\n ";
+            jsonInsert(listStr, "Sev", severity, 2);
+
             // compID
-            listStr += "\t\t\"CompID\": \"" +
+            jsonInsert(listStr, "CompID",
                        getNumberString(
-                           "0x%X", pel.privateHeader().header().componentID) +
-                       "\",\n ";
+                           "0x%X", pel.privateHeader().header().componentID),
+                       2);
+
             found = listStr.rfind(",");
             if (found != std::string::npos)
             {
                 listStr.replace(found, 1, "");
-                listStr += "\t},\n";
+                listStr += "    },\n";
             }
             foundPEL = true;
         }