PEL: peltool: Add const strings for section header
Added "Section Version", "Sub-section type" and "Created by" constant strings.
Updated all getJSON() functions to use the new constants.
Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: I434192afed929972845c3cfb8876cc5ef784eec2
diff --git a/extensions/openpower-pels/user_header.cpp b/extensions/openpower-pels/user_header.cpp
index e29ffdf..8984dc7 100644
--- a/extensions/openpower-pels/user_header.cpp
+++ b/extensions/openpower-pels/user_header.cpp
@@ -152,18 +152,11 @@
hostState = iter->second;
}
- char tmpUhVal[8];
- sprintf(tmpUhVal, "%d", userHeaderVersion);
- std::string uhVerStr(tmpUhVal);
- sprintf(tmpUhVal, "0x%X", _header.componentID);
- std::string uhCbStr(tmpUhVal);
- sprintf(tmpUhVal, "%d", _header.subType);
- std::string uhStStr(tmpUhVal);
-
std::string uh;
- jsonInsert(uh, "Section Version", uhVerStr, 1);
- jsonInsert(uh, "Sub-section type", uhStStr, 1);
- jsonInsert(uh, "Log Committed by", uhCbStr, 1);
+ jsonInsert(uh, pv::sectionVer, getNumberString("%d", userHeaderVersion), 1);
+ jsonInsert(uh, pv::subSection, getNumberString("%d", _header.subType), 1);
+ jsonInsert(uh, "Log Committed by",
+ getNumberString("0x%X", _header.componentID), 1);
jsonInsert(uh, "Subsystem", subsystem, 1);
jsonInsert(uh, "Event Scope", eventScope, 1);
jsonInsert(uh, "Event Severity", severity, 1);