Skip to content

Commit a9fc467

Browse files
Reverting pldmtool traces
- pldmtool is console based tool and while printing messages on console using lg2 format then it's adding extra unwanted things like line no, braces etc. - lg2 is systemd journal specific logging mechanism so we don't require lg2 in pldmtool directory so reverting changes only for pldmtool directory. Signed-off-by: Kamalkumar Patel <[email protected]>
1 parent 738cfd0 commit a9fc467

7 files changed

+105
-113
lines changed

Diff for: pldmtool/oem/ibm/pldm_oem_ibm.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88

99
#include <endian.h>
1010

11-
#include <phosphor-logging/lg2.hpp>
12-
1311
#include <iostream>
1412
#include <string>
15-
16-
PHOSPHOR_LOG2_USING;
17-
1813
namespace pldmtool
1914
{
2015

@@ -76,8 +71,8 @@ class GetAlertStatus : public CommandInterface
7671

7772
if (rc != PLDM_SUCCESS || completionCode != PLDM_SUCCESS)
7873
{
79-
error("Response Message Error: rc={RC} cc={CC}", "RC", rc, "CC",
80-
static_cast<int>(completionCode));
74+
std::cerr << "Response Message Error: "
75+
<< "rc=" << rc << ",cc=" << (int)completionCode << "\n";
8176
return;
8277
}
8378

@@ -126,15 +121,15 @@ class GetFileTable : public CommandInterface
126121
0, request);
127122
if (rc != PLDM_SUCCESS)
128123
{
129-
error("PLDM: Request Message Error, rc ={RC}", "RC", rc);
124+
std::cerr << "PLDM: Request Message Error, rc =" << rc << std::endl;
130125
return;
131126
}
132127

133128
std::vector<uint8_t> responseMsg;
134129
rc = pldmSendRecv(requestMsg, responseMsg);
135130
if (rc != PLDM_SUCCESS)
136131
{
137-
error("PLDM: Communication Error, rc ={RC}", "RC", rc);
132+
std::cerr << "PLDM: Communication Error, rc =" << rc << std::endl;
138133
return;
139134
}
140135

@@ -153,8 +148,8 @@ class GetFileTable : public CommandInterface
153148

154149
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
155150
{
156-
error("Response Message Error: rc={RC} cc={CC}", "RC", rc, "CC",
157-
static_cast<int>(cc));
151+
std::cerr << "Response Message Error: "
152+
<< ", rc=" << rc << ", cc=" << (int)cc << std::endl;
158153
return;
159154
}
160155

Diff for: pldmtool/pldm_base_cmd.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include <string>
1515

16-
PHOSPHOR_LOG2_USING;
17-
1816
namespace pldmtool
1917
{
2018

@@ -113,8 +111,8 @@ class GetPLDMTypes : public CommandInterface
113111
types.data());
114112
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
115113
{
116-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
117-
"KEY1", (int)cc);
114+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
115+
rc, "KEY1", (int)cc);
118116
return;
119117
}
120118

@@ -184,8 +182,8 @@ class GetPLDMVersion : public CommandInterface
184182
&version);
185183
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
186184
{
187-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
188-
"KEY1", (int)cc);
185+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
186+
rc, "KEY1", (int)cc);
189187
return;
190188
}
191189
char buffer[16] = {0};
@@ -234,8 +232,8 @@ class GetTID : public CommandInterface
234232
auto rc = decode_get_tid_resp(responsePtr, payloadLength, &cc, &tid);
235233
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
236234
{
237-
error("Response Message Error:rc = {KEY0}, cc={KEY1}", "KEY0", rc,
238-
"KEY1", (int)cc);
235+
lg2::error("Response Message Error:rc = {KEY0}, cc={KEY1}", "KEY0",
236+
rc, "KEY1", (int)cc);
239237
return;
240238
}
241239
ordered_json data;
@@ -282,8 +280,8 @@ class GetPLDMCommands : public CommandInterface
282280
cmdTypes.data());
283281
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
284282
{
285-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
286-
"KEY1", (int)cc);
283+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
284+
rc, "KEY1", (int)cc);
287285
return;
288286
}
289287
printPldmCommands(cmdTypes, pldmType);

Diff for: pldmtool/pldm_bios_cmd.cpp

+31-32
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include <map>
1313
#include <optional>
1414

15-
PHOSPHOR_LOG2_USING;
16-
1715
namespace pldmtool
1816
{
1917

@@ -75,8 +73,8 @@ class GetDateTime : public CommandInterface
7573
&month, &year);
7674
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
7775
{
78-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
79-
"KEY1", (int)cc);
76+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
77+
rc, "KEY1", (int)cc);
8078
return;
8179
}
8280

@@ -133,7 +131,7 @@ class SetDateTime : public CommandInterface
133131
if (!uintToDate(tmData, &year, &month, &day, &hours, &minutes,
134132
&seconds))
135133
{
136-
error("decode date Error: tmData={KEY0}", "KEY0", tmData);
134+
lg2::error("decode date Error: tmData={KEY0}", "KEY0", tmData);
137135

138136
return {PLDM_ERROR_INVALID_DATA, requestMsg};
139137
}
@@ -153,8 +151,8 @@ class SetDateTime : public CommandInterface
153151

154152
if (rc != PLDM_SUCCESS || completionCode != PLDM_SUCCESS)
155153
{
156-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
157-
"KEY1", (int)completionCode);
154+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
155+
rc, "KEY1", (int)completionCode);
158156

159157
return;
160158
}
@@ -212,15 +210,16 @@ class GetBIOSTableHandler : public CommandInterface
212210
tableType, request);
213211
if (rc != PLDM_SUCCESS)
214212
{
215-
error("Encode GetBIOSTable Error, tableType= {KEY0}, rc = {KEY1}",
216-
"KEY0", pldmBIOSTableMap.at(tableType), "KEY1", rc);
213+
lg2::error(
214+
"Encode GetBIOSTable Error, tableType= {KEY0}, rc = {KEY1}",
215+
"KEY0", pldmBIOSTableMap.at(tableType), "KEY1", rc);
217216
return std::nullopt;
218217
}
219218
std::vector<uint8_t> responseMsg;
220219
rc = pldmSendRecv(requestMsg, responseMsg);
221220
if (rc != PLDM_SUCCESS)
222221
{
223-
error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
222+
lg2::error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
224223
return std::nullopt;
225224
}
226225

@@ -237,7 +236,7 @@ class GetBIOSTableHandler : public CommandInterface
237236

238237
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
239238
{
240-
error(
239+
lg2::error(
241240
"GetBIOSTable Response Error: tableType={KEY0}, rc ={KEY1}, cc={KEY2}",
242241
"KEY0", pldmBIOSTableMap.at(tableType), "KEY1", rc, "KEY2",
243242
(int)cc);
@@ -379,7 +378,7 @@ class GetBIOSTableHandler : public CommandInterface
379378
}
380379
else
381380
{
382-
info("Get AttributeType failed.");
381+
lg2::info("Get AttributeType failed.");
383382
}
384383
}
385384
switch (attrType)
@@ -454,7 +453,7 @@ class GetBIOSTableHandler : public CommandInterface
454453
case PLDM_BIOS_PASSWORD:
455454
case PLDM_BIOS_PASSWORD_READ_ONLY:
456455
{
457-
info("Password attribute: Not Supported");
456+
lg2::info("Password attribute: Not Supported");
458457
break;
459458
}
460459
}
@@ -519,7 +518,7 @@ class GetBIOSTable : public GetBIOSTableHandler
519518
{
520519
if (!stringTable)
521520
{
522-
error("GetBIOSStringTable Error");
521+
lg2::error("GetBIOSStringTable Error");
523522
return;
524523
}
525524
ordered_json stringdata;
@@ -539,7 +538,7 @@ class GetBIOSTable : public GetBIOSTableHandler
539538
{
540539
if (!stringTable)
541540
{
542-
error("GetBIOSAttributeTable Error");
541+
lg2::error("GetBIOSAttributeTable Error");
543542
return;
544543
}
545544
ordered_json output;
@@ -565,7 +564,7 @@ class GetBIOSTable : public GetBIOSTableHandler
565564
}
566565
else
567566
{
568-
error("Get AttributeType failed.");
567+
lg2::error("Get AttributeType failed.");
569568
}
570569

571570
switch (attrType)
@@ -658,7 +657,7 @@ class GetBIOSTable : public GetBIOSTableHandler
658657
}
659658
case PLDM_BIOS_PASSWORD:
660659
case PLDM_BIOS_PASSWORD_READ_ONLY:
661-
alert("Password attribute: Not Supported");
660+
lg2::alert("Password attribute: Not Supported");
662661
}
663662
output.emplace_back(std::move(attrdata));
664663
}
@@ -670,7 +669,7 @@ class GetBIOSTable : public GetBIOSTableHandler
670669
{
671670
if (!attrValTable)
672671
{
673-
error("GetBIOSAttributeValueTable Error");
672+
lg2::error("GetBIOSAttributeValueTable Error");
674673
return;
675674
}
676675
ordered_json output;
@@ -715,14 +714,14 @@ class GetBIOSAttributeCurrentValueByHandle : public GetBIOSTableHandler
715714

716715
if (!stringTable || !attrTable)
717716
{
718-
info("StringTable/AttrTable Unavaliable");
717+
lg2::info("StringTable/AttrTable Unavaliable");
719718
return;
720719
}
721720

722721
auto handle = findAttrHandleByName(attrName, *attrTable, *stringTable);
723722
if (!handle)
724723
{
725-
error("Could not find the attribute {KEY0}", "KEY0", attrName);
724+
lg2::error("Can not find the attribute {KEY0}", "KEY0", attrName);
726725
return;
727726
}
728727

@@ -735,15 +734,15 @@ class GetBIOSAttributeCurrentValueByHandle : public GetBIOSTableHandler
735734
instanceId, 0, PLDM_GET_FIRSTPART, *handle, request);
736735
if (rc != PLDM_SUCCESS)
737736
{
738-
error("PLDM: Request Message Error, rc ={KEY0}", "KEY0", rc);
737+
lg2::error("PLDM: Request Message Error, rc ={KEY0}", "KEY0", rc);
739738
return;
740739
}
741740

742741
std::vector<uint8_t> responseMsg;
743742
rc = pldmSendRecv(requestMsg, responseMsg);
744743
if (rc != PLDM_SUCCESS)
745744
{
746-
error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
745+
lg2::error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
747746
return;
748747
}
749748

@@ -759,8 +758,8 @@ class GetBIOSAttributeCurrentValueByHandle : public GetBIOSTableHandler
759758
&attributeData);
760759
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
761760
{
762-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
763-
"KEY1", (int)cc);
761+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
762+
rc, "KEY1", (int)cc);
764763

765764
return;
766765
}
@@ -810,15 +809,15 @@ class SetBIOSAttributeCurrentValue : public GetBIOSTableHandler
810809

811810
if (!stringTable || !attrTable)
812811
{
813-
info("StringTable/AttrTable Unavaliable");
812+
lg2::info("StringTable/AttrTable Unavaliable");
814813
return;
815814
}
816815

817816
auto attrEntry = findAttrEntryByName(attrName, *attrTable,
818817
*stringTable);
819818
if (attrEntry == nullptr)
820819
{
821-
info("Could not find attribute :{KEY0}", "KEY0", attrName);
820+
lg2::info("Could not find attribute :{KEY0}", "KEY0", attrName);
822821
return;
823822
}
824823

@@ -849,7 +848,7 @@ class SetBIOSAttributeCurrentValue : public GetBIOSTableHandler
849848
attrValue.c_str());
850849
if (stringEntry == nullptr)
851850
{
852-
info("Set Attribute Error: It's not a possible value");
851+
lg2::info("Set Attribute Error: It's not a possible value");
853852

854853
return;
855854
}
@@ -864,7 +863,7 @@ class SetBIOSAttributeCurrentValue : public GetBIOSTableHandler
864863
}
865864
if (i == pvNum)
866865
{
867-
info("Set Attribute Error: It's not a possible value");
866+
lg2::info("Set Attribute Error: It's not a possible value");
868867
return;
869868
}
870869

@@ -935,14 +934,14 @@ class SetBIOSAttributeCurrentValue : public GetBIOSTableHandler
935934

936935
if (rc != PLDM_SUCCESS)
937936
{
938-
error("PLDM: Request Message Error, rc ={KEY0}", "KEY0", rc);
937+
lg2::error("PLDM: Request Message Error, rc ={KEY0}", "KEY0", rc);
939938
return;
940939
}
941940
std::vector<uint8_t> responseMsg;
942941
rc = pldmSendRecv(requestMsg, responseMsg);
943942
if (rc != PLDM_SUCCESS)
944943
{
945-
error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
944+
lg2::error("PLDM: Communication Error, rc ={KEY0}", "KEY0", rc);
946945
return;
947946
}
948947
uint8_t cc = 0;
@@ -955,8 +954,8 @@ class SetBIOSAttributeCurrentValue : public GetBIOSTableHandler
955954
responsePtr, payloadLength, &cc, &nextTransferHandle);
956955
if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
957956
{
958-
error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0", rc,
959-
"KEY1", (int)cc);
957+
lg2::error("Response Message Error: rc = {KEY0}, cc={KEY1}", "KEY0",
958+
rc, "KEY1", (int)cc);
960959
return;
961960
}
962961

0 commit comments

Comments
 (0)