Replace logging with std::format
std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.
Unfortunately, given its level of compile time checks, it needs to be a
method, instead of the stream style logging we had before. This
requires a pretty substantial change. Fortunately, this change can be
largely automated, via the script included in this commit under
scripts/replace_logs.py. This is to aid people in moving their
patchsets over to the new form in the short period where old patches
will be based on the old logging. The intention is that this script
eventually goes away.
The old style logging (stream based) looked like.
BMCWEB_LOG_DEBUG << "Foo " << foo;
The new equivalent of the above would be:
BMCWEB_LOG_DEBUG("Foo {}", foo);
In the course of doing this, this also cleans up several ignored linter
errors, including macro usage, and array to pointer deconstruction.
Note, This patchset does remove the timestamp from the log message. In
practice, this was duplicated between journald and bmcweb, and there's
no need for both to exist.
One design decision of note is the addition of logPtr. Because the
compiler can't disambiguate between const char* and const MyThing*, it's
necessary to add an explicit cast to void*. This is identical to how
fmt handled it.
Tested: compiled with logging meson_option enabled, and launched bmcweb
Saw the usual logging, similar to what was present before:
```
[Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled
[Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800
[Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist
[Info src/webserver_main.cpp:59] Starting webserver on port 18080
[Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file.
[Info src/webserver_main.cpp:137] Start Hostname Monitor Service...
```
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index a1c4fb9..00d77c8 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -287,13 +287,13 @@
// NOLINTNEXTLINE
bmcweb::split(result, sseFilter, ' ');
- BMCWEB_LOG_DEBUG << "No of tokens in SEE query: " << result.size();
+ BMCWEB_LOG_DEBUG("No of tokens in SEE query: {}", result.size());
constexpr uint8_t divisor = 4;
constexpr uint8_t minTokenSize = 3;
if (result.size() % divisor != minTokenSize)
{
- BMCWEB_LOG_ERROR << "Invalid SSE filter specified.";
+ BMCWEB_LOG_ERROR("Invalid SSE filter specified.");
return false;
}
@@ -309,8 +309,8 @@
// SSE supports only "or" and "and" in query params.
if ((separator != "or") && (separator != "and"))
{
- BMCWEB_LOG_ERROR
- << "Invalid group operator in SSE query parameters";
+ BMCWEB_LOG_ERROR(
+ "Invalid group operator in SSE query parameters");
return false;
}
}
@@ -318,12 +318,12 @@
// SSE supports only "eq" as per spec.
if (op != "eq")
{
- BMCWEB_LOG_ERROR
- << "Invalid assignment operator in SSE query parameters";
+ BMCWEB_LOG_ERROR(
+ "Invalid assignment operator in SSE query parameters");
return false;
}
- BMCWEB_LOG_DEBUG << key << " : " << value;
+ BMCWEB_LOG_DEBUG("{} : {}", key, value);
if (key == "EventFormatType")
{
formatType = value;
@@ -342,8 +342,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Invalid property(" << key
- << ")in SSE filter query.";
+ BMCWEB_LOG_ERROR("Invalid property({})in SSE filter query.", key);
return false;
}
}
@@ -477,14 +476,14 @@
messageArgsView, timestamp,
customText, bmcLogEntry) != 0)
{
- BMCWEB_LOG_DEBUG << "Read eventLog entry failed";
+ BMCWEB_LOG_DEBUG("Read eventLog entry failed");
continue;
}
}
if (logEntryArray.empty())
{
- BMCWEB_LOG_DEBUG << "No log entries available to be transferred.";
+ BMCWEB_LOG_DEBUG("No log entries available to be transferred.");
return;
}
@@ -521,9 +520,9 @@
nlohmann::json msg;
if (!telemetry::fillReport(msg, reportId, var))
{
- BMCWEB_LOG_ERROR << "Failed to fill the MetricReport for DBus "
- "Report with id "
- << reportId;
+ BMCWEB_LOG_ERROR("Failed to fill the MetricReport for DBus "
+ "Report with id {}",
+ reportId);
return;
}
@@ -553,7 +552,7 @@
void setSubscriptionId(const std::string& id2)
{
- BMCWEB_LOG_DEBUG << "Subscription ID: " << id2;
+ BMCWEB_LOG_DEBUG("Subscription ID: {}", id2);
subId = id2;
}
@@ -582,8 +581,8 @@
// policy. 2XX is considered acceptable
static boost::system::error_code retryRespHandler(unsigned int respCode)
{
- BMCWEB_LOG_DEBUG
- << "Checking response code validity for SubscriptionEvent";
+ BMCWEB_LOG_DEBUG(
+ "Checking response code validity for SubscriptionEvent");
if ((respCode < 200) || (respCode >= 300))
{
return boost::system::errc::make_error_code(
@@ -661,8 +660,8 @@
if (!status)
{
- BMCWEB_LOG_ERROR
- << "Failed to validate and split destination url";
+ BMCWEB_LOG_ERROR(
+ "Failed to validate and split destination url");
continue;
}
std::shared_ptr<Subscription> subValue =
@@ -683,7 +682,7 @@
if (subValue->id.empty())
{
- BMCWEB_LOG_ERROR << "Failed to add subscription";
+ BMCWEB_LOG_ERROR("Failed to add subscription");
}
subscriptionsMap.insert(std::pair(subValue->id, subValue));
@@ -704,13 +703,13 @@
std::ifstream eventConfigFile(eventServiceFile);
if (!eventConfigFile.good())
{
- BMCWEB_LOG_DEBUG << "Old eventService config not exist";
+ BMCWEB_LOG_DEBUG("Old eventService config not exist");
return;
}
auto jsonData = nlohmann::json::parse(eventConfigFile, nullptr, false);
if (jsonData.is_discarded())
{
- BMCWEB_LOG_ERROR << "Old eventService config parse error.";
+ BMCWEB_LOG_ERROR("Old eventService config parse error.");
return;
}
@@ -732,8 +731,8 @@
true);
if (newSubscription == nullptr)
{
- BMCWEB_LOG_ERROR << "Problem reading subscription "
- "from old persistent store";
+ BMCWEB_LOG_ERROR("Problem reading subscription "
+ "from old persistent store");
continue;
}
@@ -765,9 +764,9 @@
if (retry <= 0)
{
- BMCWEB_LOG_ERROR
- << "Failed to generate random number from old "
- "persistent store";
+ BMCWEB_LOG_ERROR(
+ "Failed to generate random number from old "
+ "persistent store");
continue;
}
}
@@ -775,7 +774,7 @@
persistent_data::getConfig().writeData();
std::remove(eventServiceFile);
- BMCWEB_LOG_DEBUG << "Remove old eventservice config";
+ BMCWEB_LOG_DEBUG("Remove old eventservice config");
}
}
@@ -878,7 +877,7 @@
auto obj = subscriptionsMap.find(id);
if (obj == subscriptionsMap.end())
{
- BMCWEB_LOG_ERROR << "No subscription exist with ID:" << id;
+ BMCWEB_LOG_ERROR("No subscription exist with ID:{}", id);
return nullptr;
}
std::shared_ptr<Subscription> subValue = obj->second;
@@ -912,7 +911,7 @@
if (retry <= 0)
{
- BMCWEB_LOG_ERROR << "Failed to generate random number";
+ BMCWEB_LOG_ERROR("Failed to generate random number");
return "";
}
@@ -1024,7 +1023,7 @@
std::shared_ptr<Subscription> entry = it.second;
if (entry->destinationUrl == destUrl)
{
- BMCWEB_LOG_ERROR << "Destination exist already" << destUrl;
+ BMCWEB_LOG_ERROR("Destination exist already{}", destUrl);
return true;
}
}
@@ -1049,7 +1048,7 @@
{
if (!serviceEnabled || (noOfEventLogSubscribers == 0U))
{
- BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
+ BMCWEB_LOG_DEBUG("EventService disabled or no Subscriptions.");
return;
}
nlohmann::json eventRecord = nlohmann::json::array();
@@ -1076,8 +1075,9 @@
{
if (resType == resource)
{
- BMCWEB_LOG_INFO << "ResourceType " << resource
- << " found in the subscribed list";
+ BMCWEB_LOG_INFO(
+ "ResourceType {} found in the subscribed list",
+ resource);
isSubscribed = true;
break;
}
@@ -1103,7 +1103,7 @@
}
else
{
- BMCWEB_LOG_INFO << "Not subscribed to this resource";
+ BMCWEB_LOG_INFO("Not subscribed to this resource");
}
}
}
@@ -1124,7 +1124,7 @@
std::ifstream logStream(redfishEventLogFile);
if (!logStream.good())
{
- BMCWEB_LOG_ERROR << " Redfish log file open failed \n";
+ BMCWEB_LOG_ERROR(" Redfish log file open failed ");
return;
}
std::string logEntry;
@@ -1132,8 +1132,6 @@
{
redfishLogFilePosition = logStream.tellg();
}
-
- BMCWEB_LOG_DEBUG << "Next Log Position : " << redfishLogFilePosition;
}
void readEventLogsFromFile()
@@ -1141,7 +1139,7 @@
std::ifstream logStream(redfishEventLogFile);
if (!logStream.good())
{
- BMCWEB_LOG_ERROR << " Redfish log file open failed";
+ BMCWEB_LOG_ERROR(" Redfish log file open failed");
return;
}
@@ -1177,7 +1175,7 @@
if (event_log::getEventLogParams(logEntry, timestamp, messageID,
messageArgs) != 0)
{
- BMCWEB_LOG_DEBUG << "Read eventLog entry params failed";
+ BMCWEB_LOG_DEBUG("Read eventLog entry params failed");
continue;
}
@@ -1196,14 +1194,14 @@
if (!serviceEnabled || noOfEventLogSubscribers == 0)
{
- BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
+ BMCWEB_LOG_DEBUG("EventService disabled or no Subscriptions.");
return;
}
if (eventRecords.empty())
{
// No Records to send
- BMCWEB_LOG_DEBUG << "No log entries available to be transferred.";
+ BMCWEB_LOG_DEBUG("No log entries available to be transferred.");
return;
}
@@ -1231,7 +1229,7 @@
const std::size_t& bytesTransferred) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Callback Error: " << ec.message();
+ BMCWEB_LOG_ERROR("Callback Error: {}", ec.message());
return;
}
std::size_t index = 0;
@@ -1256,16 +1254,16 @@
continue;
}
- BMCWEB_LOG_DEBUG
- << "Redfish log file created/deleted. event.name: "
- << fileName;
+ BMCWEB_LOG_DEBUG(
+ "Redfish log file created/deleted. event.name: {}",
+ fileName);
if (event.mask == IN_CREATE)
{
if (fileWatchDesc != -1)
{
- BMCWEB_LOG_DEBUG
- << "Remove and Add inotify watcher on "
- "redfish event log file";
+ BMCWEB_LOG_DEBUG(
+ "Remove and Add inotify watcher on "
+ "redfish event log file");
// Remove existing inotify watcher and add
// with new redfish event log file.
inotify_rm_watch(inotifyFd, fileWatchDesc);
@@ -1276,8 +1274,8 @@
inotifyFd, redfishEventLogFile, IN_MODIFY);
if (fileWatchDesc == -1)
{
- BMCWEB_LOG_ERROR << "inotify_add_watch failed for "
- "redfish log file.";
+ BMCWEB_LOG_ERROR("inotify_add_watch failed for "
+ "redfish log file.");
return;
}
@@ -1317,7 +1315,7 @@
inotifyFd = inotify_init1(IN_NONBLOCK);
if (inotifyFd == -1)
{
- BMCWEB_LOG_ERROR << "inotify_init1 failed.";
+ BMCWEB_LOG_ERROR("inotify_init1 failed.");
return -1;
}
@@ -1327,8 +1325,8 @@
IN_CREATE | IN_MOVED_TO | IN_DELETE);
if (dirWatchDesc == -1)
{
- BMCWEB_LOG_ERROR
- << "inotify_add_watch failed for event log directory.";
+ BMCWEB_LOG_ERROR(
+ "inotify_add_watch failed for event log directory.");
return -1;
}
@@ -1337,8 +1335,7 @@
IN_MODIFY);
if (fileWatchDesc == -1)
{
- BMCWEB_LOG_ERROR
- << "inotify_add_watch failed for redfish log file.";
+ BMCWEB_LOG_ERROR("inotify_add_watch failed for redfish log file.");
// Don't return error if file not exist.
// Watch on directory will handle create/delete of file.
}
@@ -1355,7 +1352,7 @@
{
if (msg.is_method_error())
{
- BMCWEB_LOG_ERROR << "TelemetryMonitor Signal error";
+ BMCWEB_LOG_ERROR("TelemetryMonitor Signal error");
return;
}
@@ -1363,7 +1360,7 @@
std::string id = path.filename();
if (id.empty())
{
- BMCWEB_LOG_ERROR << "Failed to get Id from path";
+ BMCWEB_LOG_ERROR("Failed to get Id from path");
return;
}
@@ -1377,7 +1374,7 @@
[](const auto& x) { return x.first == "Readings"; });
if (found == props.end())
{
- BMCWEB_LOG_INFO << "Failed to get Readings from Report properties";
+ BMCWEB_LOG_INFO("Failed to get Readings from Report properties");
return;
}
@@ -1385,7 +1382,7 @@
std::get_if<telemetry::TimestampReadings>(&found->second);
if (readings == nullptr)
{
- BMCWEB_LOG_INFO << "Failed to get Readings from Report properties";
+ BMCWEB_LOG_INFO("Failed to get Readings from Report properties");
return;
}
@@ -1404,7 +1401,7 @@
{
if (matchTelemetryMonitor)
{
- BMCWEB_LOG_DEBUG << "Metrics report signal - Unregister";
+ BMCWEB_LOG_DEBUG("Metrics report signal - Unregister");
matchTelemetryMonitor.reset();
matchTelemetryMonitor = nullptr;
}
@@ -1414,11 +1411,11 @@
{
if (!serviceEnabled || matchTelemetryMonitor)
{
- BMCWEB_LOG_DEBUG << "Not registering metric report signal.";
+ BMCWEB_LOG_DEBUG("Not registering metric report signal.");
return;
}
- BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
+ BMCWEB_LOG_DEBUG("Metrics report signal - Register");
std::string matchStr = "type='signal',member='PropertiesChanged',"
"interface='org.freedesktop.DBus.Properties',"
"arg0=xyz.openbmc_project.Telemetry.Report";
diff --git a/redfish-core/include/gzfile.hpp b/redfish-core/include/gzfile.hpp
index 34bc151..3fa1e49 100644
--- a/redfish-core/include/gzfile.hpp
+++ b/redfish-core/include/gzfile.hpp
@@ -18,7 +18,7 @@
gzFile logStream = gzopen(filename.c_str(), "r");
if (logStream == nullptr)
{
- BMCWEB_LOG_ERROR << "Can't open gz file: " << filename << '\n';
+ BMCWEB_LOG_ERROR("Can't open gz file: {}", filename);
return false;
}
@@ -46,9 +46,9 @@
int errNum = 0;
const char* errMsg = gzerror(logStream, &errNum);
- BMCWEB_LOG_ERROR << "Error reading gz compressed data.\n"
- << "Error Message: " << errMsg << '\n'
- << "Error Number: " << errNum;
+ BMCWEB_LOG_ERROR(
+ "Error reading gz compressed data.\nError Message: {}\nError Number: {}",
+ errMsg, errNum);
}
bool readFile(gzFile logStream, uint64_t skip, uint64_t top,
@@ -71,7 +71,7 @@
bufferStr.resize(static_cast<size_t>(bytesRead));
if (!hostLogEntryParser(bufferStr, skip, top, logEntries, logCount))
{
- BMCWEB_LOG_ERROR << "Error occurs during parsing host log.\n";
+ BMCWEB_LOG_ERROR("Error occurs during parsing host log.");
return false;
}
} while (gzeof(logStream) != 1);
@@ -114,9 +114,9 @@
totalFilesSize += logEntry.size();
if (totalFilesSize > maxTotalFilesSize)
{
- BMCWEB_LOG_ERROR
- << "File size exceeds maximum allowed size of "
- << maxTotalFilesSize;
+ BMCWEB_LOG_ERROR(
+ "File size exceeds maximum allowed size of {}",
+ maxTotalFilesSize);
return false;
}
logEntries.push_back(logEntry);
@@ -145,9 +145,9 @@
totalFilesSize++;
if (totalFilesSize > maxTotalFilesSize)
{
- BMCWEB_LOG_ERROR
- << "File size exceeds maximum allowed size of "
- << maxTotalFilesSize;
+ BMCWEB_LOG_ERROR(
+ "File size exceeds maximum allowed size of {}",
+ maxTotalFilesSize);
return false;
}
logEntries.emplace_back("\n");
@@ -188,9 +188,9 @@
size_t tmpMessageSize = totalFilesSize + lastMessage.size();
if (tmpMessageSize > maxTotalFilesSize)
{
- BMCWEB_LOG_ERROR
- << "File size exceeds maximum allowed size of "
- << maxTotalFilesSize;
+ BMCWEB_LOG_ERROR(
+ "File size exceeds maximum allowed size of {}",
+ maxTotalFilesSize);
return false;
}
}
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index bb2c2f3..8b42208 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -102,8 +102,8 @@
{
if (!setSinglePrivilege(privilege))
{
- BMCWEB_LOG_CRITICAL << "Unable to set privilege " << privilege
- << "in constructor";
+ BMCWEB_LOG_CRITICAL("Unable to set privilege {}in constructor",
+ privilege);
}
}
}
@@ -295,10 +295,10 @@
}
for (const auto& requiredPrivileges : operationPrivilegesRequired)
{
- BMCWEB_LOG_DEBUG << "Checking operation privileges...";
+ BMCWEB_LOG_DEBUG("Checking operation privileges...");
if (userPrivileges.isSupersetOf(requiredPrivileges))
{
- BMCWEB_LOG_DEBUG << "...success";
+ BMCWEB_LOG_DEBUG("...success");
return true;
}
}
diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp
index c1ca38e..78de6ca 100644
--- a/redfish-core/include/query.hpp
+++ b/redfish-core/include/query.hpp
@@ -38,8 +38,8 @@
const crow::Response& resIn)
{
std::string computedEtag = resIn.computeEtag();
- BMCWEB_LOG_DEBUG << "User provided if-match etag " << ifMatchHeader
- << " computed etag " << computedEtag;
+ BMCWEB_LOG_DEBUG("User provided if-match etag {} computed etag {}",
+ ifMatchHeader, computedEtag);
if (computedEtag != ifMatchHeader)
{
messages::preconditionFailed(asyncResp->res);
@@ -47,7 +47,7 @@
}
// Restart the request without if-match
req.req.erase(boost::beast::http::field::if_match);
- BMCWEB_LOG_DEBUG << "Restarting request";
+ BMCWEB_LOG_DEBUG("Restarting request");
app.handle(req, asyncResp);
}
@@ -118,7 +118,7 @@
query_param::Query& delegated,
const query_param::QueryCapabilities& queryCapabilities)
{
- BMCWEB_LOG_DEBUG << "setup redfish route";
+ BMCWEB_LOG_DEBUG("setup redfish route");
// Section 7.4 of the redfish spec "Redfish Services shall process the
// [OData-Version header] in the following table as defined by the HTTP 1.1
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 7cae89a..59a4eb9 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -83,8 +83,8 @@
uri.substr(serviceRootUri.size(), parseCount));
if (!parsedUrl)
{
- BMCWEB_LOG_ERROR << "Failed to get target URI from "
- << uri.substr(serviceRootUri.size());
+ BMCWEB_LOG_ERROR("Failed to get target URI from {}",
+ uri.substr(serviceRootUri.size()));
return false;
}
@@ -165,7 +165,7 @@
auto parsed = boost::urls::parse_relative_ref(strValue);
if (!parsed)
{
- BMCWEB_LOG_CRITICAL << "Couldn't parse URI from resource " << strValue;
+ BMCWEB_LOG_CRITICAL("Couldn't parse URI from resource {}", strValue);
return;
}
@@ -178,7 +178,7 @@
if (crow::utility::readUrlSegments(thisUrl, "redfish", "v1", "JsonSchemas",
crow::utility::OrMorePaths()))
{
- BMCWEB_LOG_DEBUG << "Skipping JsonSchemas URI prefix fixing";
+ BMCWEB_LOG_DEBUG("Skipping JsonSchemas URI prefix fixing");
return;
}
@@ -244,7 +244,7 @@
std::string* strValue = item.get_ptr<std::string*>();
if (strValue == nullptr)
{
- BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+ BMCWEB_LOG_CRITICAL("Field wasn't a string????");
return;
}
addPrefixToStringItem(*strValue, prefix);
@@ -288,7 +288,7 @@
nlohmann::json::array_t* array = json.get_ptr<nlohmann::json::array_t*>();
if (array == nullptr)
{
- BMCWEB_LOG_ERROR << "Field wasn't an array_t????";
+ BMCWEB_LOG_ERROR("Field wasn't an array_t????");
return;
}
@@ -298,7 +298,7 @@
std::string* strHeader = item.get_ptr<std::string*>();
if (strHeader == nullptr)
{
- BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+ BMCWEB_LOG_CRITICAL("Field wasn't a string????");
continue;
}
@@ -355,7 +355,7 @@
{
// Allow all response codes because we want to surface any satellite
// issue to the client
- BMCWEB_LOG_DEBUG << "Received " << respCode << " response from satellite";
+ BMCWEB_LOG_DEBUG("Received {} response from satellite", respCode);
return boost::system::errc::make_error_code(boost::system::errc::success);
}
@@ -382,13 +382,12 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "Something went wrong while querying dbus!";
+ BMCWEB_LOG_ERROR("Something went wrong while querying dbus!");
return;
}
- BMCWEB_LOG_DEBUG << "There were "
- << std::to_string(satelliteInfo.size())
- << " satellite configs found at startup";
+ BMCWEB_LOG_DEBUG("There were {} satellite configs found at startup",
+ std::to_string(satelliteInfo.size()));
}
// Search D-Bus objects for satellite config objects and add their
@@ -404,14 +403,14 @@
if (interface.first ==
"xyz.openbmc_project.Configuration.SatelliteController")
{
- BMCWEB_LOG_DEBUG << "Found Satellite Controller at "
- << objectPath.first.str;
+ BMCWEB_LOG_DEBUG("Found Satellite Controller at {}",
+ objectPath.first.str);
if (!satelliteInfo.empty())
{
- BMCWEB_LOG_ERROR
- << "Redfish Aggregation only supports one satellite!";
- BMCWEB_LOG_DEBUG << "Clearing all satellite data";
+ BMCWEB_LOG_ERROR(
+ "Redfish Aggregation only supports one satellite!");
+ BMCWEB_LOG_DEBUG("Clearing all satellite data");
satelliteInfo.clear();
return;
}
@@ -442,7 +441,7 @@
std::get_if<std::string>(&prop.second);
if (propVal == nullptr)
{
- BMCWEB_LOG_ERROR << "Invalid Hostname value";
+ BMCWEB_LOG_ERROR("Invalid Hostname value");
return;
}
url.set_host(*propVal);
@@ -453,13 +452,13 @@
const uint64_t* propVal = std::get_if<uint64_t>(&prop.second);
if (propVal == nullptr)
{
- BMCWEB_LOG_ERROR << "Invalid Port value";
+ BMCWEB_LOG_ERROR("Invalid Port value");
return;
}
if (*propVal > std::numeric_limits<uint16_t>::max())
{
- BMCWEB_LOG_ERROR << "Port value out of range";
+ BMCWEB_LOG_ERROR("Port value out of range");
return;
}
url.set_port(std::to_string(static_cast<uint16_t>(*propVal)));
@@ -471,7 +470,7 @@
std::get_if<std::string>(&prop.second);
if (propVal == nullptr)
{
- BMCWEB_LOG_ERROR << "Invalid AuthType value";
+ BMCWEB_LOG_ERROR("Invalid AuthType value");
return;
}
@@ -479,9 +478,9 @@
// with the satellite BMC
if (*propVal != "None")
{
- BMCWEB_LOG_ERROR
- << "Unsupported AuthType value: " << *propVal
- << ", only \"none\" is supported";
+ BMCWEB_LOG_ERROR(
+ "Unsupported AuthType value: {}, only \"none\" is supported",
+ *propVal);
return;
}
url.set_scheme("http");
@@ -491,20 +490,19 @@
// Make sure all required config information was made available
if (url.host().empty())
{
- BMCWEB_LOG_ERROR << "Satellite config " << name << " missing Host";
+ BMCWEB_LOG_ERROR("Satellite config {} missing Host", name);
return;
}
if (!url.has_port())
{
- BMCWEB_LOG_ERROR << "Satellite config " << name << " missing Port";
+ BMCWEB_LOG_ERROR("Satellite config {} missing Port", name);
return;
}
if (!url.has_scheme())
{
- BMCWEB_LOG_ERROR << "Satellite config " << name
- << " missing AuthType";
+ BMCWEB_LOG_ERROR("Satellite config {} missing AuthType", name);
return;
}
@@ -519,9 +517,9 @@
resultString = "Updated existing satellite config ";
}
- BMCWEB_LOG_DEBUG << resultString << name << " at "
- << result.first->second.scheme() << "://"
- << result.first->second.encoded_host_and_port();
+ BMCWEB_LOG_DEBUG("{}{} at {}://{}", resultString, name,
+ result.first->second.scheme(),
+ result.first->second.encoded_host_and_port());
}
enum AggregationType
@@ -539,15 +537,15 @@
{
if (aggType == AggregationType::Collection)
{
- BMCWEB_LOG_DEBUG
- << "Only aggregate GET requests to top level collections";
+ BMCWEB_LOG_DEBUG(
+ "Only aggregate GET requests to top level collections");
return;
}
if (aggType == AggregationType::ContainsSubordinate)
{
- BMCWEB_LOG_DEBUG << "Only aggregate GET requests when uptree of"
- << " a top level collection";
+ BMCWEB_LOG_DEBUG(
+ "Only aggregate GET requests when uptree of a top level collection");
return;
}
}
@@ -557,7 +555,7 @@
auto localReq = std::make_shared<crow::Request>(thisReq.req, ec);
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to create copy of request";
+ BMCWEB_LOG_ERROR("Failed to create copy of request");
if (aggType == AggregationType::Resource)
{
messages::internalError(asyncResp->res);
@@ -582,8 +580,7 @@
targetPrefix += "_";
if (memberName.starts_with(targetPrefix))
{
- BMCWEB_LOG_DEBUG << "\"" << satellite.first
- << "\" is a known prefix";
+ BMCWEB_LOG_DEBUG("\"{}\" is a known prefix", satellite.first);
// Remove the known prefix from the request's URI and
// then forward to the associated satellite BMC
@@ -634,14 +631,14 @@
}
const crow::Request& thisReq = *sharedReq;
- BMCWEB_LOG_DEBUG << "Aggregation is enabled, begin processing of "
- << thisReq.target();
+ BMCWEB_LOG_DEBUG("Aggregation is enabled, begin processing of {}",
+ thisReq.target());
// We previously determined the request is for a collection. No need to
// check again
if (aggType == AggregationType::Collection)
{
- BMCWEB_LOG_DEBUG << "Aggregating a collection";
+ BMCWEB_LOG_DEBUG("Aggregating a collection");
// We need to use a specific response handler and send the
// request to all known satellites
getInstance().forwardCollectionRequests(thisReq, asyncResp,
@@ -653,8 +650,8 @@
// collection. No need to check again
if (aggType == AggregationType::ContainsSubordinate)
{
- BMCWEB_LOG_DEBUG
- << "Aggregating what may have a subordinate collection";
+ BMCWEB_LOG_DEBUG(
+ "Aggregating what may have a subordinate collection");
// We need to use a specific response handler and send the
// request to all known satellites
getInstance().forwardContainsSubordinateRequests(thisReq, asyncResp,
@@ -703,8 +700,7 @@
{
// Realistically this shouldn't get called since we perform an
// earlier check to make sure the prefix exists
- BMCWEB_LOG_ERROR << "Unrecognized satellite prefix \"" << prefix
- << "\"";
+ BMCWEB_LOG_ERROR("Unrecognized satellite prefix \"{}\"", prefix);
return;
}
@@ -714,8 +710,8 @@
if (pos == std::string::npos)
{
// If this fails then something went wrong
- BMCWEB_LOG_ERROR << "Error removing prefix \"" << prefix
- << "_\" from request URI";
+ BMCWEB_LOG_ERROR("Error removing prefix \"{}_\" from request URI",
+ prefix);
messages::internalError(asyncResp->res);
return;
}
@@ -803,7 +799,7 @@
const std::unordered_map<std::string, boost::urls::url>&)>
handler)
{
- BMCWEB_LOG_DEBUG << "Gathering satellite configs";
+ BMCWEB_LOG_DEBUG("Gathering satellite configs");
sdbusplus::message::object_path path("/xyz/openbmc_project/inventory");
dbus::utility::getManagedObjects(
"xyz.openbmc_project.EntityManager", path,
@@ -813,8 +809,8 @@
std::unordered_map<std::string, boost::urls::url> satelliteInfo;
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec.value() << ", "
- << ec.message();
+ BMCWEB_LOG_ERROR("DBUS response error {}, {}", ec.value(),
+ ec.message());
handler(ec, satelliteInfo);
return;
}
@@ -826,14 +822,14 @@
if (!satelliteInfo.empty())
{
- BMCWEB_LOG_DEBUG << "Redfish Aggregation enabled with "
- << std::to_string(satelliteInfo.size())
- << " satellite BMCs";
+ BMCWEB_LOG_DEBUG(
+ "Redfish Aggregation enabled with {} satellite BMCs",
+ std::to_string(satelliteInfo.size()));
}
else
{
- BMCWEB_LOG_DEBUG
- << "No satellite BMCs detected. Redfish Aggregation not enabled";
+ BMCWEB_LOG_DEBUG(
+ "No satellite BMCs detected. Redfish Aggregation not enabled");
}
handler(ec, satelliteInfo);
});
@@ -866,21 +862,21 @@
false);
if (jsonVal.is_discarded())
{
- BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+ BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
messages::operationFailed(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+ BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
addPrefixes(jsonVal, prefix);
- BMCWEB_LOG_DEBUG << "Added prefix to parsed satellite response";
+ BMCWEB_LOG_DEBUG("Added prefix to parsed satellite response");
asyncResp->res.result(resp.result());
asyncResp->res.jsonValue = std::move(jsonVal);
- BMCWEB_LOG_DEBUG << "Finished writing asyncResp";
+ BMCWEB_LOG_DEBUG("Finished writing asyncResp");
}
else
{
@@ -908,9 +904,9 @@
if (resp.resultInt() != 200)
{
- BMCWEB_LOG_DEBUG
- << "Collection resource does not exist in satellite BMC \""
- << prefix << "\"";
+ BMCWEB_LOG_DEBUG(
+ "Collection resource does not exist in satellite BMC \"{}\"",
+ prefix);
// Return the error if we haven't had any successes
if (asyncResp->res.resultInt() != 200)
{
@@ -930,7 +926,7 @@
false);
if (jsonVal.is_discarded())
{
- BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+ BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
// Notify the user if doing so won't overwrite a valid response
if (asyncResp->res.resultInt() != 200)
@@ -940,13 +936,13 @@
return;
}
- BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+ BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
// Now we need to add the prefix to the URIs contained in the
// response.
addPrefixes(jsonVal, prefix);
- BMCWEB_LOG_DEBUG << "Added prefix to parsed satellite response";
+ BMCWEB_LOG_DEBUG("Added prefix to parsed satellite response");
// If this resource collection does not exist on the aggregating bmc
// and has not already been added from processing the response from
@@ -959,18 +955,18 @@
if ((!jsonVal.contains("Members")) &&
(!jsonVal["Members"].is_array()))
{
- BMCWEB_LOG_DEBUG
- << "Skipping aggregating unsupported resource";
+ BMCWEB_LOG_DEBUG(
+ "Skipping aggregating unsupported resource");
return;
}
- BMCWEB_LOG_DEBUG
- << "Collection does not exist, overwriting asyncResp";
+ BMCWEB_LOG_DEBUG(
+ "Collection does not exist, overwriting asyncResp");
asyncResp->res.result(resp.result());
asyncResp->res.jsonValue = std::move(jsonVal);
asyncResp->res.addHeader("Content-Type", "application/json");
- BMCWEB_LOG_DEBUG << "Finished overwriting asyncResp";
+ BMCWEB_LOG_DEBUG("Finished overwriting asyncResp");
}
else
{
@@ -980,13 +976,14 @@
(!asyncResp->res.jsonValue["Members"].is_array()))
{
- BMCWEB_LOG_DEBUG
- << "Skipping aggregating unsupported resource";
+ BMCWEB_LOG_DEBUG(
+ "Skipping aggregating unsupported resource");
return;
}
- BMCWEB_LOG_DEBUG << "Adding aggregated resources from \""
- << prefix << "\" to collection";
+ BMCWEB_LOG_DEBUG(
+ "Adding aggregated resources from \"{}\" to collection",
+ prefix);
// TODO: This is a potential race condition with multiple
// satellites and the aggregating bmc attempting to write to
@@ -1010,8 +1007,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "Received unparsable response from \"" << prefix
- << "\"";
+ BMCWEB_LOG_ERROR("Received unparsable response from \"{}\"",
+ prefix);
// We received a response that was not a json.
// Notify the user only if we did not receive any valid responses
// and if the resource collection does not already exist on the
@@ -1041,9 +1038,9 @@
if (resp.resultInt() != 200)
{
- BMCWEB_LOG_DEBUG
- << "Resource uptree from Collection does not exist in "
- << "satellite BMC \"" << prefix << "\"";
+ BMCWEB_LOG_DEBUG(
+ "Resource uptree from Collection does not exist in satellite BMC \"{}\"",
+ prefix);
// Return the error if we haven't had any successes
if (asyncResp->res.resultInt() != 200)
{
@@ -1064,7 +1061,7 @@
false);
if (jsonVal.is_discarded())
{
- BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+ BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
// Notify the user if doing so won't overwrite a valid response
if (asyncResp->res.resultInt() != 200)
@@ -1074,7 +1071,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+ BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
// Parse response and add properties missing from the AsyncResp
// Valid properties will be of the form <property>.@odata.id and
@@ -1085,7 +1082,7 @@
jsonVal.get_ptr<nlohmann::json::object_t*>();
if (object == nullptr)
{
- BMCWEB_LOG_ERROR << "Parsed JSON was not an object?";
+ BMCWEB_LOG_ERROR("Parsed JSON was not an object?");
return;
}
@@ -1100,7 +1097,7 @@
prop.second["@odata.id"].get_ptr<std::string*>();
if (strValue == nullptr)
{
- BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+ BMCWEB_LOG_CRITICAL("Field wasn't a string????");
continue;
}
if (!searchCollectionsArray(*strValue, SearchType::CollOrCon))
@@ -1112,8 +1109,8 @@
if (!asyncResp->res.jsonValue.contains(prop.first))
{
// Only add the property if it did not already exist
- BMCWEB_LOG_DEBUG << "Adding link for " << *strValue
- << " from BMC " << prefix;
+ BMCWEB_LOG_DEBUG("Adding link for {} from BMC {}",
+ *strValue, prefix);
asyncResp->res.jsonValue[prop.first]["@odata.id"] =
*strValue;
continue;
@@ -1157,8 +1154,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "Received unparsable response from \"" << prefix
- << "\"";
+ BMCWEB_LOG_ERROR("Received unparsable response from \"{}\"",
+ prefix);
// We received as response that was not a json
// Notify the user only if we did not receive any valid responses,
// and if the resource does not already exist on the aggregating BMC
@@ -1225,7 +1222,7 @@
// being a local resource describing the satellite
if (collectionItem.starts_with("5B247A_"))
{
- BMCWEB_LOG_DEBUG << "Need to forward a request";
+ BMCWEB_LOG_DEBUG("Need to forward a request");
// Extract the prefix from the request's URI, retrieve the
// associated satellite config information, and then forward
@@ -1271,7 +1268,7 @@
return Result::LocalHandle;
}
- BMCWEB_LOG_DEBUG << "Aggregation not required for " << url.buffer();
+ BMCWEB_LOG_DEBUG("Aggregation not required for {}", url.buffer());
return Result::LocalHandle;
}
};
diff --git a/redfish-core/include/snmp_trap_event_clients.hpp b/redfish-core/include/snmp_trap_event_clients.hpp
index 08ff81b..de7bf9d 100644
--- a/redfish-core/include/snmp_trap_event_clients.hpp
+++ b/redfish-core/include/snmp_trap_event_clients.hpp
@@ -28,7 +28,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -95,8 +95,8 @@
dbus::utility::ManagedObjectType& resp) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus response error on GetManagedObjects "
- << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error on GetManagedObjects {}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -107,7 +107,7 @@
const std::string snmpId = path.filename();
if (snmpId.empty())
{
- BMCWEB_LOG_ERROR << "The SNMP client ID is wrong";
+ BMCWEB_LOG_ERROR("The SNMP client ID is wrong");
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/include/utils/chassis_utils.hpp b/redfish-core/include/utils/chassis_utils.hpp
index 9c7c7db..c8c203d 100644
--- a/redfish-core/include/utils/chassis_utils.hpp
+++ b/redfish-core/include/utils/chassis_utils.hpp
@@ -21,7 +21,7 @@
void getValidChassisPath(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& chassisId, Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "checkChassisId enter";
+ BMCWEB_LOG_DEBUG("checkChassisId enter");
constexpr std::array<std::string_view, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -33,11 +33,11 @@
chassisId](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse&
chassisPaths) mutable {
- BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter";
+ BMCWEB_LOG_DEBUG("getValidChassisPath respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR << "getValidChassisPath respHandler DBUS error: "
- << ec;
+ BMCWEB_LOG_ERROR("getValidChassisPath respHandler DBUS error: {}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -49,7 +49,7 @@
std::string chassisName = path.filename();
if (chassisName.empty())
{
- BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+ BMCWEB_LOG_ERROR("Failed to find '/' in {}", chassis);
continue;
}
if (chassisName == chassisId)
@@ -60,7 +60,7 @@
}
callback(chassisPath);
});
- BMCWEB_LOG_DEBUG << "checkChassisId exit";
+ BMCWEB_LOG_DEBUG("checkChassisId exit");
}
} // namespace chassis_utils
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index 500749c..862be90 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -37,8 +37,7 @@
std::span<const std::string_view> interfaces,
const char* subtree = "/xyz/openbmc_project/inventory")
{
- BMCWEB_LOG_DEBUG << "Get collection members for: "
- << collectionPath.buffer();
+ BMCWEB_LOG_DEBUG("Get collection members for: {}", collectionPath.buffer());
dbus::utility::getSubTreePaths(
subtree, 0, interfaces,
[collectionPath, asyncResp{std::move(asyncResp)}](
@@ -53,7 +52,7 @@
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec.value();
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec.value());
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/include/utils/dbus_utils.hpp b/redfish-core/include/utils/dbus_utils.hpp
index 7e895fe..298a56b 100644
--- a/redfish-core/include/utils/dbus_utils.hpp
+++ b/redfish-core/include/utils/dbus_utils.hpp
@@ -14,11 +14,10 @@
void operator()(const sdbusplus::UnpackErrorReason reason,
const std::string& property) const noexcept
{
- BMCWEB_LOG_ERROR
- << "DBUS property error in property: " << property << ", reason: "
- << static_cast<
- std::underlying_type_t<sdbusplus::UnpackErrorReason>>(
- reason);
+ BMCWEB_LOG_ERROR(
+ "DBUS property error in property: {}, reason: {}", property,
+ static_cast<std::underlying_type_t<sdbusplus::UnpackErrorReason>>(
+ reason));
}
};
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 642ca80..3d3ae8d 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -101,21 +101,21 @@
{
if (from > std::numeric_limits<ToType>::max())
{
- BMCWEB_LOG_DEBUG << "Value for key " << key
- << " was greater than max: " << __PRETTY_FUNCTION__;
+ BMCWEB_LOG_DEBUG("Value for key {} was greater than max: {}", key,
+ __PRETTY_FUNCTION__);
return false;
}
if (from < std::numeric_limits<ToType>::lowest())
{
- BMCWEB_LOG_DEBUG << "Value for key " << key
- << " was less than min: " << __PRETTY_FUNCTION__;
+ BMCWEB_LOG_DEBUG("Value for key {} was less than min: {}", key,
+ __PRETTY_FUNCTION__);
return false;
}
if constexpr (std::is_floating_point_v<ToType>)
{
if (std::isnan(from))
{
- BMCWEB_LOG_DEBUG << "Value for key " << key << " was NAN";
+ BMCWEB_LOG_DEBUG("Value for key {} was NAN", key);
return false;
}
}
@@ -193,9 +193,8 @@
JsonType jsonPtr = jsonValue.get_ptr<JsonType>();
if (jsonPtr == nullptr)
{
- BMCWEB_LOG_DEBUG
- << "Value for key " << key
- << " was incorrect type: " << jsonValue.type_name();
+ BMCWEB_LOG_DEBUG("Value for key {} was incorrect type: {}", key,
+ jsonValue.type_name());
return UnpackErrorCode::invalidType;
}
value = std::move(*jsonPtr);
@@ -392,7 +391,7 @@
jsonRequest.get_ptr<nlohmann::json::object_t*>();
if (obj == nullptr)
{
- BMCWEB_LOG_DEBUG << "Json value is not an object";
+ BMCWEB_LOG_DEBUG("Json value is not an object");
messages::unrecognizedRequestBody(res);
return false;
}
@@ -521,14 +520,14 @@
nlohmann::json jsonRequest;
if (!json_util::processJsonFromRequest(res, req, jsonRequest))
{
- BMCWEB_LOG_DEBUG << "Json value not readable";
+ BMCWEB_LOG_DEBUG("Json value not readable");
return std::nullopt;
}
nlohmann::json::object_t* object =
jsonRequest.get_ptr<nlohmann::json::object_t*>();
if (object == nullptr || object->empty())
{
- BMCWEB_LOG_DEBUG << "Json value is empty";
+ BMCWEB_LOG_DEBUG("Json value is empty");
messages::emptyJSON(res);
return std::nullopt;
}
@@ -568,7 +567,7 @@
nlohmann::json jsonRequest;
if (!json_util::processJsonFromRequest(res, req, jsonRequest))
{
- BMCWEB_LOG_DEBUG << "Json value not readable";
+ BMCWEB_LOG_DEBUG("Json value not readable");
return false;
}
return readJson(jsonRequest, res, key, std::forward<UnpackTypes&&>(in)...);
diff --git a/redfish-core/include/utils/pcie_util.hpp b/redfish-core/include/utils/pcie_util.hpp
index 4db6e03..a889f93 100644
--- a/redfish-core/include/utils/pcie_util.hpp
+++ b/redfish-core/include/utils/pcie_util.hpp
@@ -46,8 +46,7 @@
pcieDevicePaths) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
- << ec.message();
+ BMCWEB_LOG_DEBUG("no PCIe device paths found ec: {}", ec.message());
// Not an error, system just doesn't have PCIe info
return;
}
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 4ba521b..696e323 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -462,7 +462,7 @@
inline bool processOnly(crow::App& app, crow::Response& res,
std::function<void(crow::Response&)>& completionHandler)
{
- BMCWEB_LOG_DEBUG << "Processing only query param";
+ BMCWEB_LOG_DEBUG("Processing only query param");
auto itMembers = res.jsonValue.find("Members");
if (itMembers == res.jsonValue.end())
{
@@ -473,8 +473,9 @@
auto itMemBegin = itMembers->begin();
if (itMemBegin == itMembers->end() || itMembers->size() != 1)
{
- BMCWEB_LOG_DEBUG << "Members contains " << itMembers->size()
- << " element, returning full collection.";
+ BMCWEB_LOG_DEBUG(
+ "Members contains {} element, returning full collection.",
+ itMembers->size());
completionHandler(res);
return false;
}
@@ -482,7 +483,7 @@
auto itUrl = itMemBegin->find("@odata.id");
if (itUrl == itMemBegin->end())
{
- BMCWEB_LOG_DEBUG << "No found odata.id";
+ BMCWEB_LOG_DEBUG("No found odata.id");
messages::internalError(res);
completionHandler(res);
return false;
@@ -490,7 +491,7 @@
const std::string* url = itUrl->get_ptr<const std::string*>();
if (url == nullptr)
{
- BMCWEB_LOG_DEBUG << "@odata.id wasn't a string????";
+ BMCWEB_LOG_DEBUG("@odata.id wasn't a string????");
messages::internalError(res);
completionHandler(res);
return false;
@@ -507,7 +508,8 @@
}
auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
- BMCWEB_LOG_DEBUG << "setting completion handler on " << &asyncResp->res;
+ BMCWEB_LOG_DEBUG("setting completion handler on {}",
+ logPtr(&asyncResp->res));
asyncResp->res.setCompleteRequestHandler(std::move(completionHandler));
asyncResp->res.setIsAliveHelper(res.releaseIsAliveHelper());
app.handle(newReq, asyncResp);
@@ -579,7 +581,7 @@
for (auto& element : array)
{
nlohmann::json::json_pointer newPtr = jsonPtr / index;
- BMCWEB_LOG_DEBUG << "Traversing response at " << newPtr.to_string();
+ BMCWEB_LOG_DEBUG("Traversing response at {}", newPtr.to_string());
findNavigationReferencesRecursive(eType, element, newPtr, depth,
skipDepth, inLinks, out);
index++;
@@ -600,8 +602,7 @@
obj.begin()->second.get_ptr<const std::string*>();
if (uri != nullptr)
{
- BMCWEB_LOG_DEBUG << "Found " << *uri << " at "
- << jsonPtr.to_string();
+ BMCWEB_LOG_DEBUG("Found {} at {}", *uri, jsonPtr.to_string());
if (skipDepth == 0)
{
out.push_back({jsonPtr, *uri});
@@ -658,7 +659,7 @@
continue;
}
nlohmann::json::json_pointer newPtr = jsonPtr / element.first;
- BMCWEB_LOG_DEBUG << "Traversing response at " << newPtr;
+ BMCWEB_LOG_DEBUG("Traversing response at {}", newPtr);
findNavigationReferencesRecursive(eType, element.second, newPtr,
newDepth, skipDepth, localInLinks,
@@ -827,7 +828,7 @@
void placeResult(const nlohmann::json::json_pointer& locationToPlace,
crow::Response& res)
{
- BMCWEB_LOG_DEBUG << "placeResult for " << locationToPlace;
+ BMCWEB_LOG_DEBUG("placeResult for {}", locationToPlace);
propogateError(finalRes->res, res);
if (!res.jsonValue.is_object() || res.jsonValue.empty())
{
@@ -844,7 +845,7 @@
std::vector<ExpandNode> nodes = findNavigationReferences(
query.expandType, query.expandLevel, delegated.expandLevel,
finalRes->res.jsonValue);
- BMCWEB_LOG_DEBUG << nodes.size() << " nodes to traverse";
+ BMCWEB_LOG_DEBUG("{} nodes to traverse", nodes.size());
const std::optional<std::string> queryStr = formatQueryForExpand(query);
if (!queryStr)
{
@@ -854,7 +855,7 @@
for (const ExpandNode& node : nodes)
{
const std::string subQuery = node.uri + *queryStr;
- BMCWEB_LOG_DEBUG << "URL of subquery: " << subQuery;
+ BMCWEB_LOG_DEBUG("URL of subquery: {}", subQuery);
std::error_code ec;
crow::Request newReq({boost::beast::http::verb::get, subQuery, 11},
ec);
@@ -865,8 +866,8 @@
}
auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
- BMCWEB_LOG_DEBUG << "setting completion handler on "
- << &asyncResp->res;
+ BMCWEB_LOG_DEBUG("setting completion handler on {}",
+ logPtr(&asyncResp->res));
addAwaitingResponse(asyncResp, node.location);
app.handle(newReq, asyncResp);
@@ -902,7 +903,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Handling top/skip";
+ BMCWEB_LOG_DEBUG("Handling top/skip");
nlohmann::json::object_t::iterator members = obj->find("Members");
if (members == obj->end())
{
@@ -946,12 +947,12 @@
currRoot.get_ptr<nlohmann::json::object_t*>();
if (object != nullptr)
{
- BMCWEB_LOG_DEBUG << "Current JSON is an object";
+ BMCWEB_LOG_DEBUG("Current JSON is an object");
auto it = currRoot.begin();
while (it != currRoot.end())
{
auto nextIt = std::next(it);
- BMCWEB_LOG_DEBUG << "key=" << it.key();
+ BMCWEB_LOG_DEBUG("key={}", it.key());
const SelectTrieNode* nextNode = currNode.find(it.key());
// Per the Redfish spec section 7.3.3, the service shall select
// certain properties as if $select was omitted. This applies to
@@ -969,12 +970,12 @@
}
if (nextNode != nullptr)
{
- BMCWEB_LOG_DEBUG << "Recursively select: " << it.key();
+ BMCWEB_LOG_DEBUG("Recursively select: {}", it.key());
recursiveSelect(*it, *nextNode);
it = nextIt;
continue;
}
- BMCWEB_LOG_DEBUG << it.key() << " is getting removed!";
+ BMCWEB_LOG_DEBUG("{} is getting removed!", it.key());
it = currRoot.erase(it);
}
}
@@ -982,7 +983,7 @@
currRoot.get_ptr<nlohmann::json::array_t*>();
if (array != nullptr)
{
- BMCWEB_LOG_DEBUG << "Current JSON is an array";
+ BMCWEB_LOG_DEBUG("Current JSON is an array");
// Array index is omitted, so reuse the same Trie node
for (nlohmann::json& nextRoot : *array)
{
@@ -1000,7 +1001,7 @@
inline void processSelect(crow::Response& intermediateResponse,
const SelectTrieNode& trieRoot)
{
- BMCWEB_LOG_DEBUG << "Process $select quary parameter";
+ BMCWEB_LOG_DEBUG("Process $select quary parameter");
recursiveSelect(intermediateResponse.jsonValue, trieRoot);
}
@@ -1011,11 +1012,11 @@
{
if (!completionHandler)
{
- BMCWEB_LOG_DEBUG << "Function was invalid?";
+ BMCWEB_LOG_DEBUG("Function was invalid?");
return;
}
- BMCWEB_LOG_DEBUG << "Processing query params";
+ BMCWEB_LOG_DEBUG("Processing query params");
// If the request failed, there's no reason to even try to run query
// params.
if (intermediateResponse.resultInt() < 200 ||
@@ -1037,7 +1038,7 @@
if (query.expandType != ExpandType::None)
{
- BMCWEB_LOG_DEBUG << "Executing expand query";
+ BMCWEB_LOG_DEBUG("Executing expand query");
auto asyncResp = std::make_shared<bmcweb::AsyncResp>(
std::move(intermediateResponse));
diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp
index 176586f..cffc637 100644
--- a/redfish-core/include/utils/sw_utils.hpp
+++ b/redfish-core/include/utils/sw_utils.hpp
@@ -54,11 +54,11 @@
populateLinkToImages](
const boost::system::error_code& ec,
const dbus::utility::MapperEndPoints& functionalSw) {
- BMCWEB_LOG_DEBUG << "populateSoftwareInformation enter";
+ BMCWEB_LOG_DEBUG("populateSoftwareInformation enter");
if (ec)
{
- BMCWEB_LOG_ERROR << "error_code = " << ec;
- BMCWEB_LOG_ERROR << "error msg = " << ec.message();
+ BMCWEB_LOG_ERROR("error_code = {}", ec);
+ BMCWEB_LOG_ERROR("error msg = {}", ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -67,7 +67,7 @@
{
// Could keep going and try to populate SoftwareImages but
// something is seriously wrong, so just fail
- BMCWEB_LOG_ERROR << "Zero functional software in system";
+ BMCWEB_LOG_ERROR("Zero functional software in system");
messages::internalError(asyncResp->res);
return;
}
@@ -98,13 +98,13 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "error_code = " << ec2;
- BMCWEB_LOG_ERROR << "error msg = " << ec2.message();
+ BMCWEB_LOG_ERROR("error_code = {}", ec2);
+ BMCWEB_LOG_ERROR("error msg = {}", ec2.message());
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Found " << subtree.size() << " images";
+ BMCWEB_LOG_DEBUG("Found {} images", subtree.size());
for (const std::pair<std::string,
std::vector<std::pair<
@@ -116,7 +116,7 @@
if (swId.empty())
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "Invalid software ID";
+ BMCWEB_LOG_ERROR("Invalid software ID");
return;
}
@@ -142,8 +142,8 @@
propertiesList) {
if (ec3)
{
- BMCWEB_LOG_ERROR << "error_code = " << ec3;
- BMCWEB_LOG_ERROR << "error msg = " << ec3.message();
+ BMCWEB_LOG_ERROR("error_code = {}", ec3);
+ BMCWEB_LOG_ERROR("error msg = {}", ec3.message());
// Have seen the code update app delete the D-Bus
// object, during code update, between the call to
// mapper and here. Just leave these properties off if
@@ -185,9 +185,9 @@
return;
}
- BMCWEB_LOG_DEBUG << "Image ID: " << swId;
- BMCWEB_LOG_DEBUG << "Running image: " << runningImage;
- BMCWEB_LOG_DEBUG << "Image purpose: " << *swInvPurpose;
+ BMCWEB_LOG_DEBUG("Image ID: {}", swId);
+ BMCWEB_LOG_DEBUG("Running image: {}", runningImage);
+ BMCWEB_LOG_DEBUG("Image purpose: {}", *swInvPurpose);
if (populateLinkToImages)
{
@@ -253,7 +253,7 @@
{
return resource::State::StandbySpare;
}
- BMCWEB_LOG_DEBUG << "Default sw state " << swState << " to Disabled";
+ BMCWEB_LOG_DEBUG("Default sw state {} to Disabled", swState);
return resource::State::Disabled;
}
@@ -277,7 +277,7 @@
{
return "OK";
}
- BMCWEB_LOG_DEBUG << "Sw state " << swState << " to Warning";
+ BMCWEB_LOG_DEBUG("Sw state {} to Warning", swState);
return "Warning";
}
@@ -297,7 +297,7 @@
const std::shared_ptr<std::string>& swId,
const std::string& dbusSvc)
{
- BMCWEB_LOG_DEBUG << "getSwStatus: swId " << *swId << " svc " << dbusSvc;
+ BMCWEB_LOG_DEBUG("getSwStatus: swId {} svc {}", *swId, dbusSvc);
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, dbusSvc,
@@ -331,7 +331,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "getSwStatus: Activation " << *swInvActivation;
+ BMCWEB_LOG_DEBUG("getSwStatus: Activation {}", *swInvActivation);
asyncResp->res.jsonValue["Status"]["State"] =
getRedfishSwState(*swInvActivation);
asyncResp->res.jsonValue["Status"]["Health"] =
@@ -359,8 +359,8 @@
const dbus::utility::MapperEndPoints& objPaths) {
if (ec)
{
- BMCWEB_LOG_DEBUG << " error_code = " << ec
- << " error msg = " << ec.message();
+ BMCWEB_LOG_DEBUG(" error_code = {} error msg = {}", ec,
+ ec.message());
// System can exist with no updateable software,
// so don't throw error here.
return;
diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
index 58ab1c9..33e31f0 100644
--- a/redfish-core/include/utils/telemetry_utils.hpp
+++ b/redfish-core/include/utils/telemetry_utils.hpp
@@ -71,9 +71,9 @@
if (!parsed)
{
- BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
- "from "
- << uri;
+ BMCWEB_LOG_ERROR("Failed to get chassis and sensor Node "
+ "from {}",
+ uri);
return std::make_optional<IncorrectMetricUri>({uri, uriIdx});
}
@@ -101,9 +101,9 @@
continue;
}
- BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
- "from "
- << uri;
+ BMCWEB_LOG_ERROR("Failed to get chassis and sensor Node "
+ "from {}",
+ uri);
return std::make_optional<IncorrectMetricUri>({uri, uriIdx});
}
return std::nullopt;
diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
index 17c9111..314ea85 100644
--- a/redfish-core/include/utils/time_utils.hpp
+++ b/redfish-core/include/utils/time_utils.hpp
@@ -93,14 +93,13 @@
auto [ptr, ec] = std::from_chars(v.begin(), v.end(), ticks);
if (ec != std::errc())
{
- BMCWEB_LOG_ERROR << "Failed to convert string \"" << v
- << "\" to decimal";
+ BMCWEB_LOG_ERROR("Failed to convert string \"{}\" to decimal", v);
return std::nullopt;
}
size_t charactersRead = static_cast<size_t>(ptr - v.data());
if (ptr >= v.end())
{
- BMCWEB_LOG_ERROR << "Missing postfix";
+ BMCWEB_LOG_ERROR("Missing postfix");
return std::nullopt;
}
if (*ptr == 'D')
@@ -147,8 +146,7 @@
}
else if (stage > ProcessingStage::Milliseconds)
{
- BMCWEB_LOG_ERROR
- << "Got unexpected information at end of parse";
+ BMCWEB_LOG_ERROR("Got unexpected information at end of parse");
return std::nullopt;
}
else
@@ -170,7 +168,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Unknown postfix " << *ptr;
+ BMCWEB_LOG_ERROR("Unknown postfix {}", *ptr);
return std::nullopt;
}
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index cb469bd..173de73 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -211,8 +211,8 @@
// Both Redfish and WebUI Account Types are needed to PATCH
if (redfishType ^ webUIType)
{
- BMCWEB_LOG_ERROR
- << "Missing Redfish or WebUI Account Type to set redfish User Group";
+ BMCWEB_LOG_ERROR(
+ "Missing Redfish or WebUI Account Type to set redfish User Group");
messages::strictAccountTypes(res, "AccountTypes");
return false;
}
@@ -243,8 +243,8 @@
(accountTypes.cend() ==
std::find(accountTypes.cbegin(), accountTypes.cend(), "Redfish")))
{
- BMCWEB_LOG_ERROR
- << "User disabling OWN Redfish Account Type is not allowed";
+ BMCWEB_LOG_ERROR(
+ "User disabling OWN Redfish Account Type is not allowed");
messages::strictAccountTypes(asyncResp->res, "AccountTypes");
return;
}
@@ -264,7 +264,7 @@
updatedUserGroups, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -342,8 +342,7 @@
roleMapArray = nlohmann::json::array();
for (const auto& obj : confData.groupRoleList)
{
- BMCWEB_LOG_DEBUG << "Pushing the data groupName="
- << obj.second.groupName << "\n";
+ BMCWEB_LOG_DEBUG("Pushing the data groupName={}", obj.second.groupName);
nlohmann::json::object_t remoteGroup;
remoteGroup["RemoteGroup"] = obj.second.groupName;
@@ -376,7 +375,7 @@
index](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -388,7 +387,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Can't delete the object";
+ BMCWEB_LOG_ERROR("Can't delete the object");
messages::propertyValueTypeError(asyncResp->res, thisJson,
"RemoteRoleMapping/" +
std::to_string(index));
@@ -419,7 +418,7 @@
// Update existing RoleMapping Object
if (index < roleMapObjData.size())
{
- BMCWEB_LOG_DEBUG << "Update Role Map Object";
+ BMCWEB_LOG_DEBUG("Update Role Map Object");
// If "RemoteGroup" info is provided
if (remoteGroup)
{
@@ -439,8 +438,8 @@
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING << "DBUS response error: "
- << ec;
+ BMCWEB_LOG_WARNING("DBUS response error: {}",
+ ec);
messages::propertyValueIncorrect(asyncResp->res,
"RemoteGroup",
*remoteGroup);
@@ -474,8 +473,8 @@
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING << "DBUS response error: "
- << ec;
+ BMCWEB_LOG_WARNING("DBUS response error: {}",
+ ec);
messages::propertyValueIncorrect(
asyncResp->res, "LocalRole", *localRole);
return;
@@ -492,8 +491,8 @@
// Create a new RoleMapping Object.
else
{
- BMCWEB_LOG_DEBUG
- << "setRoleMappingProperties: Creating new Object";
+ BMCWEB_LOG_DEBUG(
+ "setRoleMappingProperties: Creating new Object");
std::string pathString = "RemoteRoleMapping/" +
std::to_string(index);
@@ -520,15 +519,15 @@
dbusObjectPath = ldapConfigObjectName;
}
- BMCWEB_LOG_DEBUG << "Remote Group=" << *remoteGroup
- << ",LocalRole=" << *localRole;
+ BMCWEB_LOG_DEBUG("Remote Group={},LocalRole={}", *remoteGroup,
+ *localRole);
crow::connections::systemBus->async_method_call(
[asyncResp, serverType, localRole,
remoteGroup](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -565,8 +564,8 @@
const dbus::utility::MapperGetObject& resp) {
if (ec || resp.empty())
{
- BMCWEB_LOG_ERROR
- << "DBUS response error during getting of service name: " << ec;
+ BMCWEB_LOG_ERROR(
+ "DBUS response error during getting of service name: {}", ec);
LDAPConfigData empty{};
callback(false, empty, ldapType);
return;
@@ -582,7 +581,7 @@
if (ec2)
{
callback(false, confData, ldapType);
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec2;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec2);
return;
}
@@ -603,8 +602,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "Can't get the DbusType for the given type="
- << ldapType;
+ BMCWEB_LOG_ERROR("Can't get the DbusType for the given type={}",
+ ldapType);
callback(false, confData, ldapType);
return;
}
@@ -808,8 +807,8 @@
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING
- << "Error Occurred in updating the service address";
+ BMCWEB_LOG_WARNING(
+ "Error Occurred in updating the service address");
messages::propertyValueIncorrect(asyncResp->res,
"ServiceAddresses",
serviceAddressList.front());
@@ -827,7 +826,7 @@
messages::propertyValueModified(asyncResp->res, "ServiceAddresses",
serviceAddressList.front());
}
- BMCWEB_LOG_DEBUG << "Updated the service address";
+ BMCWEB_LOG_DEBUG("Updated the service address");
});
}
/**
@@ -852,13 +851,13 @@
const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error occurred in updating the username";
+ BMCWEB_LOG_DEBUG("Error occurred in updating the username");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
["Username"] = username;
- BMCWEB_LOG_DEBUG << "Updated the username";
+ BMCWEB_LOG_DEBUG("Updated the username");
});
}
@@ -883,13 +882,13 @@
const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error occurred in updating the password";
+ BMCWEB_LOG_DEBUG("Error occurred in updating the password");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
["Password"] = "";
- BMCWEB_LOG_DEBUG << "Updated the password";
+ BMCWEB_LOG_DEBUG("Updated the password");
});
}
@@ -916,7 +915,7 @@
const sdbusplus::message_t& msg) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the base DN";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the base DN");
const sd_bus_error* dbusError = msg.get_error();
if ((dbusError != nullptr) &&
(dbusError->name ==
@@ -941,7 +940,7 @@
messages::propertyValueModified(
asyncResp->res, "BaseDistinguishedNames", baseDNList.front());
}
- BMCWEB_LOG_DEBUG << "Updated the base DN";
+ BMCWEB_LOG_DEBUG("Updated the base DN");
});
}
/**
@@ -966,8 +965,8 @@
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
- "username attribute";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+ "username attribute");
messages::internalError(asyncResp->res);
return;
}
@@ -975,7 +974,7 @@
auto& searchSettingsJson =
serverTypeJson["LDAPService"]["SearchSettings"];
searchSettingsJson["UsernameAttribute"] = userNameAttribute;
- BMCWEB_LOG_DEBUG << "Updated the user name attr.";
+ BMCWEB_LOG_DEBUG("Updated the user name attr.");
});
}
/**
@@ -1000,8 +999,8 @@
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
- "groupname attribute";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+ "groupname attribute");
messages::internalError(asyncResp->res);
return;
}
@@ -1009,7 +1008,7 @@
auto& searchSettingsJson =
serverTypeJson["LDAPService"]["SearchSettings"];
searchSettingsJson["GroupsAttribute"] = groupsAttribute;
- BMCWEB_LOG_DEBUG << "Updated the groupname attr";
+ BMCWEB_LOG_DEBUG("Updated the groupname attr");
});
}
/**
@@ -1033,13 +1032,13 @@
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the service enable";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the service enable");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["ServiceEnabled"] =
serviceEnabled;
- BMCWEB_LOG_DEBUG << "Updated Service enable = " << serviceEnabled;
+ BMCWEB_LOG_DEBUG("Updated Service enable = {}", serviceEnabled);
});
}
@@ -1057,7 +1056,7 @@
"Cookie", cookie, "SessionToken", sessionToken,
"XToken", xToken, "TLS", tls))
{
- BMCWEB_LOG_ERROR << "Cannot read values from AuthMethod tag";
+ BMCWEB_LOG_ERROR("Cannot read values from AuthMethod tag");
return;
}
@@ -1334,7 +1333,7 @@
// If password is invalid
messages::propertyValueFormatError(asyncResp->res,
*password, "Password");
- BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+ BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
}
else if (retval != PAM_SUCCESS)
{
@@ -1356,7 +1355,7 @@
*enabled, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1381,7 +1380,7 @@
priv, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1409,7 +1408,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1506,8 +1505,8 @@
return;
}
- BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
- << "properties for AccountService";
+ BMCWEB_LOG_DEBUG("Got {}properties for AccountService",
+ propertiesList.size());
const uint8_t* minPasswordLength = nullptr;
const uint32_t* accountUnlockTimeout = nullptr;
@@ -1737,7 +1736,7 @@
if (user.empty())
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "Invalid firmware ID";
+ BMCWEB_LOG_ERROR("Invalid firmware ID");
return;
}
@@ -1795,7 +1794,7 @@
"xyz.openbmc_project.User.Manager", userPath,
"xyz.openbmc_project.Object.Delete", "Delete");
- BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+ BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
return;
}
@@ -1854,8 +1853,8 @@
{
if (!accountTypeUserGroups.empty())
{
- BMCWEB_LOG_ERROR
- << "Only administrator can get HostConsole access";
+ BMCWEB_LOG_ERROR(
+ "Only administrator can get HostConsole access");
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
@@ -1921,7 +1920,7 @@
const std::vector<std::string>& allGroupsList) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "ERROR with async_method_call";
+ BMCWEB_LOG_DEBUG("ERROR with async_method_call");
messages::internalError(asyncResp->res);
return;
}
@@ -1988,7 +1987,7 @@
if (!effectiveUserPrivileges.isSupersetOf(
requiredPermissionsToChangeNonSelf))
{
- BMCWEB_LOG_DEBUG << "GET Account denied access";
+ BMCWEB_LOG_DEBUG("GET Account denied access");
messages::insufficientPrivilege(asyncResp->res);
return;
}
@@ -2039,7 +2038,7 @@
std::get_if<bool>(&property.second);
if (userEnabled == nullptr)
{
- BMCWEB_LOG_ERROR << "UserEnabled wasn't a bool";
+ BMCWEB_LOG_ERROR("UserEnabled wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2051,9 +2050,9 @@
std::get_if<bool>(&property.second);
if (userLocked == nullptr)
{
- BMCWEB_LOG_ERROR << "UserLockedForF"
- "ailedAttempt "
- "wasn't a bool";
+ BMCWEB_LOG_ERROR("UserLockedForF"
+ "ailedAttempt "
+ "wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2068,15 +2067,15 @@
std::get_if<std::string>(&property.second);
if (userPrivPtr == nullptr)
{
- BMCWEB_LOG_ERROR << "UserPrivilege wasn't a "
- "string";
+ BMCWEB_LOG_ERROR("UserPrivilege wasn't a "
+ "string");
messages::internalError(asyncResp->res);
return;
}
std::string role = getRoleIdFromPrivilege(*userPrivPtr);
if (role.empty())
{
- BMCWEB_LOG_ERROR << "Invalid user role";
+ BMCWEB_LOG_ERROR("Invalid user role");
messages::internalError(asyncResp->res);
return;
}
@@ -2093,8 +2092,8 @@
std::get_if<bool>(&property.second);
if (userPasswordExpired == nullptr)
{
- BMCWEB_LOG_ERROR
- << "UserPasswordExpired wasn't a bool";
+ BMCWEB_LOG_ERROR(
+ "UserPasswordExpired wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2108,14 +2107,14 @@
&property.second);
if (userGroups == nullptr)
{
- BMCWEB_LOG_ERROR
- << "userGroups wasn't a string vector";
+ BMCWEB_LOG_ERROR(
+ "userGroups wasn't a string vector");
messages::internalError(asyncResp->res);
return;
}
if (!translateUserGroup(*userGroups, asyncResp->res))
{
- BMCWEB_LOG_ERROR << "userGroups mapping failed";
+ BMCWEB_LOG_ERROR("userGroups mapping failed");
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/aggregation_service.hpp b/redfish-core/lib/aggregation_service.hpp
index 6c93613..be1336b 100644
--- a/redfish-core/lib/aggregation_service.hpp
+++ b/redfish-core/lib/aggregation_service.hpp
@@ -210,8 +210,8 @@
"</redfish/v1/JsonSchemas/AggregationService/AggregationSource.json>; rel=describedby");
// Needed to prevent unused variable error
- BMCWEB_LOG_DEBUG << "Added link header to response from "
- << aggregationSourceId;
+ BMCWEB_LOG_DEBUG("Added link header to response from {}",
+ aggregationSourceId);
}
inline void requestRoutesAggregationSource(App& app)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index b358b5f..8cd05d6 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -89,7 +89,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec;
+ BMCWEB_LOG_ERROR("Failed to reset bios: {}", ec);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 87e41d53..265a1ea 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -30,7 +30,7 @@
{
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(resp);
return;
}
@@ -83,7 +83,7 @@
const std::string& cableObjectPath,
const dbus::utility::MapperServiceMap& serviceMap)
{
- BMCWEB_LOG_DEBUG << "Get Properties for cable " << cableObjectPath;
+ BMCWEB_LOG_DEBUG("Get Properties for cable {}", cableObjectPath);
for (const auto& [service, interfaces] : serviceMap)
{
@@ -121,7 +121,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "Cable Id: " << cableId;
+ BMCWEB_LOG_DEBUG("Cable Id: {}", cableId);
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Inventory.Item.Cable"};
dbus::utility::getSubTree(
@@ -137,7 +137,7 @@
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 62704c9..0073bc9 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -70,7 +70,7 @@
certificate, "CertificateType",
certificateType))
{
- BMCWEB_LOG_ERROR << "Required parameters are missing";
+ BMCWEB_LOG_ERROR("Required parameters are missing");
messages::internalError(asyncResp->res);
return {};
}
@@ -111,22 +111,22 @@
std::ofstream::trunc);
out << certString;
out.close();
- BMCWEB_LOG_DEBUG << "Creating certificate file"
- << certificateFile.string();
+ BMCWEB_LOG_DEBUG("Creating certificate file{}",
+ certificateFile.string());
}
}
~CertificateFile()
{
if (std::filesystem::exists(certDirectory))
{
- BMCWEB_LOG_DEBUG << "Removing certificate file"
- << certificateFile.string();
+ BMCWEB_LOG_DEBUG("Removing certificate file{}",
+ certificateFile.string());
std::error_code ec;
std::filesystem::remove_all(certDirectory, ec);
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to remove temp directory"
- << certDirectory.string();
+ BMCWEB_LOG_ERROR("Failed to remove temp directory{}",
+ certDirectory.string());
}
}
}
@@ -228,7 +228,7 @@
const dbus::utility::MapperGetSubTreePathsResponse& certPaths) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Certificate collection query failed: " << ec;
+ BMCWEB_LOG_ERROR("Certificate collection query failed: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -241,7 +241,7 @@
std::string certId = objPath.filename();
if (certId.empty())
{
- BMCWEB_LOG_ERROR << "Invalid certificate objPath " << certPath;
+ BMCWEB_LOG_ERROR("Invalid certificate objPath {}", certPath);
continue;
}
@@ -294,8 +294,8 @@
const std::string& certId, const boost::urls::url& certURL,
const std::string& name)
{
- BMCWEB_LOG_DEBUG << "getCertificateProperties Path=" << objectPath
- << " certId=" << certId << " certURl=" << certURL;
+ BMCWEB_LOG_DEBUG("getCertificateProperties Path={} certId={} certURl={}",
+ objectPath, certId, certURL);
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objectPath, certs::certPropIntf,
[asyncResp, certURL, certId,
@@ -303,7 +303,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::resourceNotFound(asyncResp->res, "Certificate", certId);
return;
}
@@ -389,7 +389,7 @@
messages::resourceNotFound(asyncResp->res, "Certificate", id);
return;
}
- BMCWEB_LOG_INFO << "Certificate deleted";
+ BMCWEB_LOG_INFO("Certificate deleted");
asyncResp->res.result(boost::beast::http::status::no_content);
},
service, objectPath, certs::objDeleteIntf, "Delete");
@@ -479,7 +479,7 @@
certificateUri, "CertificateType",
certificateType))
{
- BMCWEB_LOG_ERROR << "Required parameters are missing";
+ BMCWEB_LOG_ERROR("Required parameters are missing");
return;
}
@@ -503,7 +503,7 @@
"CertificateUri");
return;
}
- BMCWEB_LOG_INFO << "Certificate URI to replace: " << certURI;
+ BMCWEB_LOG_INFO("Certificate URI to replace: {}", certURI);
boost::urls::result<boost::urls::url_view> parsedUrl =
boost::urls::parse_relative_ref(certURI);
@@ -559,7 +559,7 @@
name](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
if (ec.value() ==
boost::system::linux_error::bad_request_descriptor)
{
@@ -570,8 +570,8 @@
return;
}
getCertificateProperties(asyncResp, objectPath, service, id, url, name);
- BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
- << certFile->getCertFilePath();
+ BMCWEB_LOG_DEBUG("HTTPS certificate install file={}",
+ certFile->getCertFilePath());
},
service, objectPath, certs::certReplaceIntf, "Replace",
certFile->getCertFilePath());
@@ -594,21 +594,20 @@
const std::string& certObjPath,
const std::string& csrObjPath)
{
- BMCWEB_LOG_DEBUG << "getCSR CertObjectPath" << certObjPath
- << " CSRObjectPath=" << csrObjPath
- << " service=" << service;
+ BMCWEB_LOG_DEBUG("getCSR CertObjectPath{} CSRObjectPath={} service={}",
+ certObjPath, csrObjPath, service);
crow::connections::systemBus->async_method_call(
[asyncResp, certURI](const boost::system::error_code& ec,
const std::string& csr) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
if (csr.empty())
{
- BMCWEB_LOG_ERROR << "CSR read is empty";
+ BMCWEB_LOG_ERROR("CSR read is empty");
messages::internalError(asyncResp->res);
return;
}
@@ -793,16 +792,16 @@
// before completion.
if (ec != boost::asio::error::operation_aborted)
{
- BMCWEB_LOG_ERROR << "Async_wait failed " << ec;
+ BMCWEB_LOG_ERROR("Async_wait failed {}", ec);
}
return;
}
- BMCWEB_LOG_ERROR << "Timed out waiting for Generating CSR";
+ BMCWEB_LOG_ERROR("Timed out waiting for Generating CSR");
messages::internalError(asyncResp->res);
});
// create a matcher to wait on CSR object
- BMCWEB_LOG_DEBUG << "create matcher with path " << objectPath;
+ BMCWEB_LOG_DEBUG("create matcher with path {}", objectPath);
std::string match("type='signal',"
"interface='org.freedesktop.DBus.ObjectManager',"
"path='" +
@@ -815,7 +814,7 @@
timeout.cancel();
if (m.is_method_error())
{
- BMCWEB_LOG_ERROR << "Dbus method error!!!";
+ BMCWEB_LOG_ERROR("Dbus method error!!!");
messages::internalError(asyncResp->res);
return;
}
@@ -824,7 +823,7 @@
sdbusplus::message::object_path csrObjectPath;
m.read(csrObjectPath, interfacesProperties);
- BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
+ BMCWEB_LOG_DEBUG("CSR object added{}", csrObjectPath.str);
for (const auto& interface : interfacesProperties)
{
if (interface.first == "xyz.openbmc_project.Certs.CSR")
@@ -839,7 +838,7 @@
[asyncResp](const boost::system::error_code& ec, const std::string&) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message();
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -909,7 +908,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
+ BMCWEB_LOG_DEBUG("HTTPSCertificateCollection::doPost");
asyncResp->res.jsonValue["Name"] = "HTTPS Certificate";
asyncResp->res.jsonValue["Description"] = "HTTPS Certificate";
@@ -918,7 +917,7 @@
if (certFileBody.empty())
{
- BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+ BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
messages::unrecognizedRequestBody(asyncResp->res);
return;
}
@@ -931,7 +930,7 @@
const std::string& objectPath) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -943,8 +942,8 @@
certId);
getCertificateProperties(asyncResp, objectPath, certs::httpsServiceName,
certId, certURL, "HTTPS Certificate");
- BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
- << certFile->getCertFilePath();
+ BMCWEB_LOG_DEBUG("HTTPS certificate install file={}",
+ certFile->getCertFilePath());
},
certs::httpsServiceName, certs::httpsObjectPath, certs::certInstallIntf,
"Install", certFile->getCertFilePath());
@@ -959,7 +958,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "HTTPS Certificate ID=" << id;
+ BMCWEB_LOG_DEBUG("HTTPS Certificate ID={}", id);
const boost::urls::url certURL = boost::urls::format(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/{}", id);
std::string objPath =
@@ -1024,7 +1023,7 @@
if (certFileBody.empty())
{
- BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+ BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
messages::unrecognizedRequestBody(asyncResp->res);
return;
}
@@ -1037,7 +1036,7 @@
const std::string& objectPath) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1048,8 +1047,8 @@
"/redfish/v1/AccountService/LDAP/Certificates/{}", certId);
getCertificateProperties(asyncResp, objectPath, certs::ldapServiceName,
certId, certURL, "LDAP Certificate");
- BMCWEB_LOG_DEBUG << "LDAP certificate install file="
- << certFile->getCertFilePath();
+ BMCWEB_LOG_DEBUG("LDAP certificate install file={}",
+ certFile->getCertFilePath());
},
certs::ldapServiceName, certs::ldapObjectPath, certs::certInstallIntf,
"Install", certFile->getCertFilePath());
@@ -1064,7 +1063,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "LDAP Certificate ID=" << id;
+ BMCWEB_LOG_DEBUG("LDAP Certificate ID={}", id);
const boost::urls::url certURL = boost::urls::format(
"/redfish/v1/AccountService/LDAP/Certificates/{}", id);
std::string objPath =
@@ -1082,7 +1081,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Delete LDAP Certificate ID=" << id;
+ BMCWEB_LOG_DEBUG("Delete LDAP Certificate ID={}", id);
std::string objPath =
sdbusplus::message::object_path(certs::ldapObjectPath) / id;
@@ -1146,7 +1145,7 @@
if (certFileBody.empty())
{
- BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+ BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
messages::unrecognizedRequestBody(asyncResp->res);
return;
}
@@ -1158,7 +1157,7 @@
const std::string& objectPath) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1170,8 +1169,8 @@
getCertificateProperties(asyncResp, objectPath,
certs::authorityServiceName, certId, certURL,
"TrustStore Certificate");
- BMCWEB_LOG_DEBUG << "TrustStore certificate install file="
- << certFile->getCertFilePath();
+ BMCWEB_LOG_DEBUG("TrustStore certificate install file={}",
+ certFile->getCertFilePath());
},
certs::authorityServiceName, certs::authorityObjectPath,
certs::certInstallIntf, "Install", certFile->getCertFilePath());
@@ -1186,7 +1185,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Truststore Certificate ID=" << id;
+ BMCWEB_LOG_DEBUG("Truststore Certificate ID={}", id);
const boost::urls::url certURL = boost::urls::format(
"/redfish/v1/Managers/bmc/Truststore/Certificates/{}", id);
std::string objPath =
@@ -1204,7 +1203,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Delete TrustStore Certificate ID=" << id;
+ BMCWEB_LOG_DEBUG("Delete TrustStore Certificate ID={}", id);
std::string objPath =
sdbusplus::message::object_path(certs::authorityObjectPath) / id;
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index fc89d03..fbab894 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -62,7 +62,7 @@
const std::vector<std::string>& storageList) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "getStorageLink got DBUS response error";
+ BMCWEB_LOG_DEBUG("getStorageLink got DBUS response error");
return;
}
@@ -109,15 +109,15 @@
{
// Service not available, no error, just don't return
// chassis state info
- BMCWEB_LOG_DEBUG << "Service not available " << ec;
+ BMCWEB_LOG_DEBUG("Service not available {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Chassis state: " << chassisState;
+ BMCWEB_LOG_DEBUG("Chassis state: {}", chassisState);
// Verify Chassis State
if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.On")
{
@@ -137,7 +137,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
+ BMCWEB_LOG_DEBUG("Get intrusion status by service ");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, service, objPath,
@@ -148,7 +148,7 @@
{
// do not add err msg in redfish response, because this is not
// mandatory property
- BMCWEB_LOG_ERROR << "DBUS response error " << ec << "\n";
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
return;
}
@@ -175,7 +175,7 @@
{
// do not add err msg in redfish response, because this is not
// mandatory property
- BMCWEB_LOG_INFO << "DBUS error: no matched iface " << ec << "\n";
+ BMCWEB_LOG_INFO("DBUS error: no matched iface {}", ec);
return;
}
// Iterate over all retrieved ObjectPaths.
@@ -220,7 +220,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
}
return;
@@ -231,7 +231,7 @@
}
if (upstreamChassisPaths.size() > 1)
{
- BMCWEB_LOG_ERROR << chassisId << " is contained by mutliple chassis";
+ BMCWEB_LOG_ERROR("{} is contained by mutliple chassis", chassisId);
messages::internalError(asyncResp->res);
return;
}
@@ -241,8 +241,8 @@
std::string upstreamChassis = upstreamChassisPath.filename();
if (upstreamChassis.empty())
{
- BMCWEB_LOG_WARNING << "Malformed upstream Chassis path "
- << upstreamChassisPath.str << " on " << chassisId;
+ BMCWEB_LOG_WARNING("Malformed upstream Chassis path {} on {}",
+ upstreamChassisPath.str, chassisId);
return;
}
@@ -259,7 +259,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
}
return;
@@ -280,9 +280,8 @@
std::string downstreamChassis = downstreamChassisPath.filename();
if (downstreamChassis.empty())
{
- BMCWEB_LOG_WARNING << "Malformed downstream Chassis path "
- << downstreamChassisPath.str << " on "
- << chassisId;
+ BMCWEB_LOG_WARNING("Malformed downstream Chassis path {} on {}",
+ downstreamChassisPath.str, chassisId);
continue;
}
nlohmann::json link;
@@ -298,7 +297,7 @@
const std::string& chassisId,
const std::string& chassisPath)
{
- BMCWEB_LOG_DEBUG << "Get chassis connectivity";
+ BMCWEB_LOG_DEBUG("Get chassis connectivity");
dbus::utility::getAssociationEndPoints(
chassisPath + "/contained_by",
@@ -333,7 +332,7 @@
const std::string& property) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Location";
+ BMCWEB_LOG_ERROR("DBUS response error for Location");
messages::internalError(asyncResp->res);
return;
}
@@ -354,7 +353,7 @@
const std::string& chassisUUID) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error for UUID";
+ BMCWEB_LOG_ERROR("DBUS response error for UUID");
messages::internalError(asyncResp->res);
return;
}
@@ -382,7 +381,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -424,7 +423,7 @@
if (connectionNames.empty())
{
- BMCWEB_LOG_ERROR << "Got 0 Connection names";
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
continue;
}
@@ -484,8 +483,8 @@
const std::string& property) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "DBus response error for AssetTag: " << ec2;
+ BMCWEB_LOG_ERROR(
+ "DBus response error for AssetTag: {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -502,9 +501,9 @@
const bool property) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "DBus response error for HotPluggable: "
- << ec2;
+ BMCWEB_LOG_ERROR(
+ "DBus response error for HotPluggable: {}",
+ ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -693,7 +692,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -716,7 +715,7 @@
if (connectionNames.empty())
{
- BMCWEB_LOG_ERROR << "Got 0 Connection names";
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
continue;
}
@@ -793,7 +792,7 @@
{
if (eMsg.get_error() == nullptr)
{
- BMCWEB_LOG_ERROR << "D-Bus response error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error: {}", ec);
messages::internalError(res);
return;
}
@@ -804,13 +803,13 @@
if (errorMessage ==
std::string_view("xyz.openbmc_project.State.Chassis.Error.BMCNotReady"))
{
- BMCWEB_LOG_DEBUG << "BMC not ready, operation not allowed right now";
+ BMCWEB_LOG_DEBUG("BMC not ready, operation not allowed right now");
messages::serviceTemporarilyUnavailable(res, "10");
return;
}
- BMCWEB_LOG_ERROR << "Chassis Power Cycle fail " << ec
- << " sdbusplus:" << errorMessage;
+ BMCWEB_LOG_ERROR("Chassis Power Cycle fail {} sdbusplus:{}", ec,
+ errorMessage);
messages::internalError(res);
}
@@ -828,7 +827,7 @@
const dbus::utility::MapperGetSubTreePathsResponse& chassisList) {
if (ec)
{
- BMCWEB_LOG_ERROR << "[mapper] Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_ERROR("[mapper] Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -877,7 +876,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "Post Chassis Reset.";
+ BMCWEB_LOG_DEBUG("Post Chassis Reset.");
std::string resetType;
@@ -888,8 +887,7 @@
if (resetType != "PowerCycle")
{
- BMCWEB_LOG_DEBUG << "Invalid property value for ResetType: "
- << resetType;
+ BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", resetType);
messages::actionParameterNotSupported(asyncResp->res, resetType,
"ResetType");
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 36873b9..218affe 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -499,9 +499,9 @@
}
else
{
- BMCWEB_LOG_ERROR
- << "Got extra property: " << property.first
- << " on the " << objpath.first.str << " object";
+ BMCWEB_LOG_ERROR(
+ "Got extra property: {} on the {} object",
+ property.first, objpath.first.str);
}
}
}
@@ -593,9 +593,9 @@
}
else
{
- BMCWEB_LOG_ERROR
- << "Got extra property: " << property.first
- << " on the " << objpath.first.str << " object";
+ BMCWEB_LOG_ERROR(
+ "Got extra property: {} on the {} object",
+ property.first, objpath.first.str);
}
}
// Check if given address is local, or global
@@ -1047,7 +1047,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1066,7 +1066,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1076,7 +1076,7 @@
inline void setDHCPv4Config(const std::string& propertyName, const bool& value,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << propertyName << " = " << value;
+ BMCWEB_LOG_DEBUG("{} = {}", propertyName, value);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Network",
"/xyz/openbmc_project/network/dhcp",
@@ -1084,7 +1084,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1191,14 +1191,14 @@
nextUseDomain = ethData.hostNameEnabled;
}
- BMCWEB_LOG_DEBUG << "set DHCPEnabled...";
+ BMCWEB_LOG_DEBUG("set DHCPEnabled...");
setDHCPEnabled(ifaceId, "DHCPEnabled", nextv4DHCPState, nextv6DHCPState,
asyncResp);
- BMCWEB_LOG_DEBUG << "set DNSEnabled...";
+ BMCWEB_LOG_DEBUG("set DNSEnabled...");
setDHCPv4Config("DNSEnabled", nextDNS, asyncResp);
- BMCWEB_LOG_DEBUG << "set NTPEnabled...";
+ BMCWEB_LOG_DEBUG("set NTPEnabled...");
setDHCPv4Config("NTPEnabled", nextNTP, asyncResp);
- BMCWEB_LOG_DEBUG << "set HostNameEnabled...";
+ BMCWEB_LOG_DEBUG("set HostNameEnabled...");
setDHCPv4Config("HostNameEnabled", nextUseDomain, asyncResp);
}
@@ -1707,7 +1707,7 @@
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "DBus error: " << dbusError->name;
+ BMCWEB_LOG_DEBUG("DBus error: {}", dbusError->name);
if (std::string_view("org.freedesktop.DBus.Error.UnknownObject") ==
dbusError->name)
@@ -1741,7 +1741,7 @@
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "DBus error: " << dbusError->name;
+ BMCWEB_LOG_DEBUG("DBus error: {}", dbusError->name);
if (std::string_view(
"xyz.openbmc_project.Common.Error.ResourceNotFound") ==
@@ -1856,7 +1856,7 @@
"Links/RelatedInterfaces/0/@odata.id");
return;
}
- BMCWEB_LOG_INFO << "Parent Interface URI: " << parentInterfaceUri;
+ BMCWEB_LOG_INFO("Parent Interface URI: {}", parentInterfaceUri);
boost::urls::result<boost::urls::url_view> parsedUri =
boost::urls::parse_relative_ref(parentInterfaceUri);
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 4919dec..35e3a1c 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -198,7 +198,7 @@
return;
}
- BMCWEB_LOG_ERROR << "D-Bus response error on GetManagedObjects " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error on GetManagedObjects {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -209,7 +209,7 @@
const std::string snmpId = path.filename();
if (snmpId.empty())
{
- BMCWEB_LOG_ERROR << "The SNMP client ID is wrong";
+ BMCWEB_LOG_ERROR("The SNMP client ID is wrong");
messages::internalError(asyncResp->res);
return;
}
@@ -324,8 +324,7 @@
if (!crow::utility::validateAndSplitUrl(destUrl, urlProto, host, port,
path))
{
- BMCWEB_LOG_WARNING
- << "Failed to validate and split destination url";
+ BMCWEB_LOG_WARNING("Failed to validate and split destination url");
messages::propertyValueFormatError(asyncResp->res, destUrl,
"Destination");
return;
diff --git a/redfish-core/lib/eventservice_sse.hpp b/redfish-core/lib/eventservice_sse.hpp
index 864383c..4ad29a6 100644
--- a/redfish-core/lib/eventservice_sse.hpp
+++ b/redfish-core/lib/eventservice_sse.hpp
@@ -13,7 +13,7 @@
if ((manager.getNumberOfSubscriptions() >= maxNoOfSubscriptions) ||
manager.getNumberOfSSESubscriptions() >= maxNoOfSSESubscriptions)
{
- BMCWEB_LOG_WARNING << "Max SSE subscriptions reached";
+ BMCWEB_LOG_WARNING("Max SSE subscriptions reached");
conn.close("Max SSE subscriptions reached");
return;
}
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index d3119d3..2a85f42 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -33,7 +33,7 @@
return;
}
- BMCWEB_LOG_ERROR << "DBus method call failed with error " << ec.value();
+ BMCWEB_LOG_ERROR("DBus method call failed with error {}", ec.value());
messages::internalError(res);
}
@@ -50,7 +50,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Location";
+ BMCWEB_LOG_ERROR("DBUS response error for Location");
messages::internalError(asyncResp->res);
}
return;
@@ -76,7 +76,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Properties";
+ BMCWEB_LOG_ERROR("DBUS response error for Properties");
messages::internalError(asyncResp->res);
}
return;
@@ -133,7 +133,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for State";
+ BMCWEB_LOG_ERROR("DBUS response error for State");
messages::internalError(asyncResp->res);
}
return;
@@ -160,7 +160,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Health";
+ BMCWEB_LOG_ERROR("DBUS response error for Health");
messages::internalError(asyncResp->res);
}
return;
@@ -240,7 +240,7 @@
return;
}
}
- BMCWEB_LOG_WARNING << "Adapter not found";
+ BMCWEB_LOG_WARNING("Adapter not found");
messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId);
});
}
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 7680531..3a7e2e2 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -68,9 +68,9 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR
- << "DBUS response error for getAssociatedSubTreePaths "
- << ec.value();
+ BMCWEB_LOG_ERROR(
+ "DBUS response error for getAssociatedSubTreePaths {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -185,8 +185,8 @@
const dbus::utility::MapperGetObject& object) {
if (ec || object.empty())
{
- BMCWEB_LOG_ERROR << "DBUS response error on getDbusObject "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error on getDbusObject {}",
+ ec.value());
messages::internalError(asyncResp->res);
return;
}
@@ -195,7 +195,7 @@
return;
}
- BMCWEB_LOG_WARNING << "Fan not found " << fanId;
+ BMCWEB_LOG_WARNING("Fan not found {}", fanId);
messages::resourceNotFound(asyncResp->res, "Fan", fanId);
}
@@ -239,8 +239,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Health "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -264,8 +264,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for State "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for State {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -291,8 +291,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Properties"
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -348,8 +348,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Location"
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Location{}",
+ ec.value());
messages::internalError(aResp->res);
}
return;
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index c5249f2..55f79bc 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -114,8 +114,8 @@
std::get_if<std::vector<std::string>>(&value);
if (endpoints == nullptr)
{
- BMCWEB_LOG_ERROR << "Illegal association at "
- << path.str;
+ BMCWEB_LOG_ERROR("Illegal association at {}",
+ path.str);
continue;
}
bool containsChild = false;
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 72d02b9..0a8936d 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -34,7 +34,7 @@
inline void
getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get hypervisor state information.";
+ BMCWEB_LOG_DEBUG("Get hypervisor state information.");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.State.Hypervisor",
"/xyz/openbmc_project/state/hypervisor0",
@@ -43,13 +43,13 @@
const std::string& hostState) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
// This is an optional D-Bus object so just return if
// error occurs
return;
}
- BMCWEB_LOG_DEBUG << "Hypervisor state: " << hostState;
+ BMCWEB_LOG_DEBUG("Hypervisor state: {}", hostState);
// Verify Host State
if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
{
@@ -106,7 +106,7 @@
inline void
getHypervisorActions(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get hypervisor actions.";
+ BMCWEB_LOG_DEBUG("Get hypervisor actions.");
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.State.Host"};
dbus::utility::getDbusObject(
@@ -117,7 +117,7 @@
objInfo) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
// This is an optional D-Bus object so just return if
// error occurs
return;
@@ -259,9 +259,9 @@
}
else
{
- BMCWEB_LOG_ERROR
- << "Got extra property: " << property.first
- << " on the " << objpath.first.str << " object";
+ BMCWEB_LOG_ERROR(
+ "Got extra property: {} on the {} object",
+ property.first, objpath.first.str);
}
}
}
@@ -330,7 +330,7 @@
ipv4Data);
if (!found)
{
- BMCWEB_LOG_INFO << "Hypervisor Interface not found";
+ BMCWEB_LOG_INFO("Hypervisor Interface not found");
}
callback(found, ethData, ipv4Data);
});
@@ -349,8 +349,8 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& ethIfaceId, const std::string& ipv4Address)
{
- BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Address
- << " on Iface: " << ethIfaceId;
+ BMCWEB_LOG_DEBUG("Setting the Hypervisor IPaddress : {} on Iface: {}",
+ ipv4Address, ethIfaceId);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
"/xyz/openbmc_project/network/hypervisor/" + ethIfaceId + "/ipv4/addr0",
@@ -358,10 +358,10 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "Hypervisor IPaddress is Set";
+ BMCWEB_LOG_DEBUG("Hypervisor IPaddress is Set");
});
}
@@ -378,8 +378,8 @@
setHypervisorIPv4Subnet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& ethIfaceId, const uint8_t subnet)
{
- BMCWEB_LOG_DEBUG << "Setting the Hypervisor subnet : " << subnet
- << " on Iface: " << ethIfaceId;
+ BMCWEB_LOG_DEBUG("Setting the Hypervisor subnet : {} on Iface: {}", subnet,
+ ethIfaceId);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -388,10 +388,10 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "SubnetMask is Set";
+ BMCWEB_LOG_DEBUG("SubnetMask is Set");
});
}
@@ -408,8 +408,8 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& gateway)
{
- BMCWEB_LOG_DEBUG
- << "Setting the DefaultGateway to the last configured gateway";
+ BMCWEB_LOG_DEBUG(
+ "Setting the DefaultGateway to the last configured gateway");
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -418,10 +418,10 @@
gateway, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "Default Gateway is Set";
+ BMCWEB_LOG_DEBUG("Default Gateway is Set");
});
}
@@ -515,7 +515,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -542,11 +542,11 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Hypervisor IPaddress Origin is Set";
+ BMCWEB_LOG_DEBUG("Hypervisor IPaddress Origin is Set");
});
}
@@ -637,8 +637,8 @@
return;
}
- BMCWEB_LOG_DEBUG << "Calling createHypervisorIPv4 on : " << ifaceId
- << "," << *address;
+ BMCWEB_LOG_DEBUG("Calling createHypervisorIPv4 on : {},{}", ifaceId,
+ *address);
createHypervisorIPv4(ifaceId, prefixLength, *gateway, *address,
asyncResp);
// Set the DHCPEnabled to false since the Static IPv4 is set
@@ -786,7 +786,7 @@
messages::resourceNotFound(asyncResp->res, "System", "hypervisor");
return;
}
- BMCWEB_LOG_DEBUG << "Hypervisor is available";
+ BMCWEB_LOG_DEBUG("Hypervisor is available");
asyncResp->res.jsonValue["@odata.type"] =
"#ComputerSystem.v1_6_0.ComputerSystem";
@@ -888,8 +888,8 @@
if ((ipv4Json.is_null()) &&
(translateDhcpEnabledToBool(ethData.dhcpEnabled, true)))
{
- BMCWEB_LOG_INFO << "Ignoring the delete on ipv4StaticAddresses "
- "as the interface is DHCP enabled";
+ BMCWEB_LOG_INFO("Ignoring the delete on ipv4StaticAddresses "
+ "as the interface is DHCP enabled");
}
else
{
@@ -929,7 +929,7 @@
objInfo) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
// No hypervisor objects found by mapper
if (ec.value() == boost::system::errc::io_error)
@@ -1012,7 +1012,7 @@
[asyncResp, resetType](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
if (ec.value() == boost::asio::error::invalid_argument)
{
messages::actionParameterNotSupported(asyncResp->res,
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 53df1db..f36a319 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -35,7 +35,7 @@
inline void
getIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get led groups";
+ BMCWEB_LOG_DEBUG("Get led groups");
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
"/xyz/openbmc_project/led/groups/enclosure_identify_blink",
@@ -45,8 +45,8 @@
// proceed to get enclosure_identify state.
if (ec == boost::system::errc::invalid_argument)
{
- BMCWEB_LOG_DEBUG
- << "Get identity blinking LED failed, missmatch in property type";
+ BMCWEB_LOG_DEBUG(
+ "Get identity blinking LED failed, missmatch in property type");
messages::internalError(asyncResp->res);
return;
}
@@ -67,8 +67,8 @@
const bool ledOn) {
if (ec2 == boost::system::errc::invalid_argument)
{
- BMCWEB_LOG_DEBUG
- << "Get enclosure identity led failed, missmatch in property type";
+ BMCWEB_LOG_DEBUG(
+ "Get enclosure identity led failed, missmatch in property type");
messages::internalError(asyncResp->res);
return;
}
@@ -103,7 +103,7 @@
setIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& ledState)
{
- BMCWEB_LOG_DEBUG << "Set led groups";
+ BMCWEB_LOG_DEBUG("Set led groups");
bool ledOn = false;
bool ledBlinkng = false;
@@ -146,7 +146,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -165,7 +165,7 @@
inline void getLocationIndicatorActive(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get LocationIndicatorActive";
+ BMCWEB_LOG_DEBUG("Get LocationIndicatorActive");
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
"/xyz/openbmc_project/led/groups/enclosure_identify_blink",
@@ -175,8 +175,8 @@
// proceed to get enclosure_identify state.
if (ec == boost::system::errc::invalid_argument)
{
- BMCWEB_LOG_DEBUG
- << "Get identity blinking LED failed, missmatch in property type";
+ BMCWEB_LOG_DEBUG(
+ "Get identity blinking LED failed, missmatch in property type");
messages::internalError(asyncResp->res);
return;
}
@@ -197,8 +197,8 @@
const bool ledOn) {
if (ec2 == boost::system::errc::invalid_argument)
{
- BMCWEB_LOG_DEBUG
- << "Get enclosure identity led failed, missmatch in property type";
+ BMCWEB_LOG_DEBUG(
+ "Get enclosure identity led failed, missmatch in property type");
messages::internalError(asyncResp->res);
return;
}
@@ -224,7 +224,7 @@
inline void setLocationIndicatorActive(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool ledState)
{
- BMCWEB_LOG_DEBUG << "Set LocationIndicatorActive";
+ BMCWEB_LOG_DEBUG("Set LocationIndicatorActive");
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
@@ -244,7 +244,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 72930cc..9cb1fe0 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -159,8 +159,7 @@
ret = sd_journal_get_realtime_usec(journal, ×tamp);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "Failed to read entry timestamp: "
- << strerror(-ret);
+ BMCWEB_LOG_ERROR("Failed to read entry timestamp: {}", strerror(-ret));
return false;
}
entryTimestamp = redfish::time_utils::getDateTimeUintUs(timestamp);
@@ -183,8 +182,7 @@
ret = sd_journal_get_realtime_usec(journal, &curTs);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "Failed to read entry timestamp: "
- << strerror(-ret);
+ BMCWEB_LOG_ERROR("Failed to read entry timestamp: {}", strerror(-ret));
return false;
}
// If the timestamp isn't unique, increment the index
@@ -448,8 +446,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "getDumpEntriesPath() invalid dump type: "
- << dumpType;
+ BMCWEB_LOG_ERROR("getDumpEntriesPath() invalid dump type: {}",
+ dumpType);
}
// Returns empty string on error
@@ -475,7 +473,7 @@
const dbus::utility::ManagedObjectType& objects) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DumpEntry resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR("DumpEntry resp_handler got error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -592,7 +590,7 @@
const dbus::utility::ManagedObjectType& resp) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DumpEntry resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR("DumpEntry resp_handler got error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -665,7 +663,7 @@
}
if (!foundDumpEntry)
{
- BMCWEB_LOG_WARNING << "Can't find Dump Entry " << entryID;
+ BMCWEB_LOG_WARNING("Can't find Dump Entry {}", entryID);
messages::resourceNotFound(asyncResp->res, dumpType + " dump",
entryID);
return;
@@ -679,7 +677,7 @@
{
auto respHandler =
[asyncResp, entryID](const boost::system::error_code& ec) {
- BMCWEB_LOG_DEBUG << "Dump Entry doDelete callback: Done";
+ BMCWEB_LOG_DEBUG("Dump Entry doDelete callback: Done");
if (ec)
{
if (ec.value() == EBADR)
@@ -687,8 +685,9 @@
messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
return;
}
- BMCWEB_LOG_ERROR << "Dump (DBus) doDelete respHandler got error "
- << ec << " entryID=" << entryID;
+ BMCWEB_LOG_ERROR(
+ "Dump (DBus) doDelete respHandler got error {} entryID={}", ec,
+ entryID);
messages::internalError(asyncResp->res);
return;
}
@@ -728,7 +727,7 @@
const std::string* value = std::get_if<std::string>(&val);
if (value == nullptr)
{
- BMCWEB_LOG_ERROR << "Status property value is null";
+ BMCWEB_LOG_ERROR("Status property value is null");
return DumpCreationProgress::DUMP_CREATE_FAILED;
}
return mapDbusStatusToDumpProgress(*value);
@@ -762,7 +761,7 @@
if (dumpEntryPath.empty())
{
- BMCWEB_LOG_ERROR << "Invalid dump type received";
+ BMCWEB_LOG_ERROR("Invalid dump type received");
messages::internalError(asyncResp->res);
return;
}
@@ -774,8 +773,8 @@
const std::string& introspectXml) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Introspect call failed with error: "
- << ec.message();
+ BMCWEB_LOG_ERROR("Introspect call failed with error: {}",
+ ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -790,7 +789,7 @@
tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
if (pRoot == nullptr)
{
- BMCWEB_LOG_ERROR << "XML document failed to parse";
+ BMCWEB_LOG_ERROR("XML document failed to parse");
messages::internalError(asyncResp->res);
return;
}
@@ -822,8 +821,8 @@
const std::shared_ptr<task::TaskData>& taskData) {
if (ec2)
{
- BMCWEB_LOG_ERROR << createdObjPath.str
- << ": Error in creating dump";
+ BMCWEB_LOG_ERROR("{}: Error in creating dump",
+ createdObjPath.str);
taskData->messages.emplace_back(messages::internalError());
taskData->state = "Cancelled";
return task::completed;
@@ -839,16 +838,16 @@
getDumpCompletionStatus(values);
if (dumpStatus == DumpCreationProgress::DUMP_CREATE_FAILED)
{
- BMCWEB_LOG_ERROR << createdObjPath.str
- << ": Error in creating dump";
+ BMCWEB_LOG_ERROR("{}: Error in creating dump",
+ createdObjPath.str);
taskData->state = "Cancelled";
return task::completed;
}
if (dumpStatus == DumpCreationProgress::DUMP_CREATE_INPROGRESS)
{
- BMCWEB_LOG_DEBUG << createdObjPath.str
- << ": Dump creation task is in progress";
+ BMCWEB_LOG_DEBUG("{}: Dump creation task is in progress",
+ createdObjPath.str);
return !task::completed;
}
}
@@ -864,8 +863,8 @@
taskData->payload->httpHeaders.emplace_back(std::move(headerLoc));
- BMCWEB_LOG_DEBUG << createdObjPath.str
- << ": Dump creation task completed";
+ BMCWEB_LOG_DEBUG("{}: Dump creation task completed",
+ createdObjPath.str);
taskData->state = "Completed";
return task::completed;
},
@@ -907,8 +906,8 @@
{
if (!oemDiagnosticDataType || !diagnosticDataType)
{
- BMCWEB_LOG_ERROR
- << "CreateDump action parameter 'DiagnosticDataType'/'OEMDiagnosticDataType' value not found!";
+ BMCWEB_LOG_ERROR(
+ "CreateDump action parameter 'DiagnosticDataType'/'OEMDiagnosticDataType' value not found!");
messages::actionParameterMissing(
asyncResp->res, "CollectDiagnosticData",
"DiagnosticDataType & OEMDiagnosticDataType");
@@ -917,7 +916,7 @@
if ((*oemDiagnosticDataType != "System") ||
(*diagnosticDataType != "OEM"))
{
- BMCWEB_LOG_ERROR << "Wrong parameter values passed";
+ BMCWEB_LOG_ERROR("Wrong parameter values passed");
messages::internalError(asyncResp->res);
return;
}
@@ -927,16 +926,16 @@
{
if (!diagnosticDataType)
{
- BMCWEB_LOG_ERROR
- << "CreateDump action parameter 'DiagnosticDataType' not found!";
+ BMCWEB_LOG_ERROR(
+ "CreateDump action parameter 'DiagnosticDataType' not found!");
messages::actionParameterMissing(
asyncResp->res, "CollectDiagnosticData", "DiagnosticDataType");
return;
}
if (*diagnosticDataType != "Manager")
{
- BMCWEB_LOG_ERROR
- << "Wrong parameter value passed for 'DiagnosticDataType'";
+ BMCWEB_LOG_ERROR(
+ "Wrong parameter value passed for 'DiagnosticDataType'");
messages::internalError(asyncResp->res);
return;
}
@@ -944,7 +943,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "CreateDump failed. Unknown dump type";
+ BMCWEB_LOG_ERROR("CreateDump failed. Unknown dump type");
messages::internalError(asyncResp->res);
return;
}
@@ -969,7 +968,7 @@
const sdbusplus::message::object_path& objPath) mutable {
if (ec)
{
- BMCWEB_LOG_ERROR << "CreateDump resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR("CreateDump resp_handler got error {}", ec);
const sd_bus_error* dbusError = msg.get_error();
if (dbusError == nullptr)
{
@@ -977,8 +976,8 @@
return;
}
- BMCWEB_LOG_ERROR << "CreateDump DBus error: " << dbusError->name
- << " and error msg: " << dbusError->message;
+ BMCWEB_LOG_ERROR("CreateDump DBus error: {} and error msg: {}",
+ dbusError->name, dbusError->message);
if (std::string_view(
"xyz.openbmc_project.Common.Error.NotAllowed") ==
dbusError->name)
@@ -1010,7 +1009,7 @@
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Dump Created. Path: " << objPath.str;
+ BMCWEB_LOG_DEBUG("Dump Created. Path: {}", objPath.str);
createDumpTaskCallback(std::move(payload), asyncResp, objPath);
},
"xyz.openbmc_project.Dump.Manager",
@@ -1029,7 +1028,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "clearDump resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR("clearDump resp_handler got error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1148,7 +1147,7 @@
subtreePath) {
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
return;
}
@@ -1252,7 +1251,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to reload rsyslog: " << ec;
+ BMCWEB_LOG_ERROR("Failed to reload rsyslog: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1309,7 +1308,7 @@
logEntryIter++;
if (message == nullptr)
{
- BMCWEB_LOG_WARNING << "Log entry not found in registry: " << logEntry;
+ BMCWEB_LOG_WARNING("Log entry not found in registry: {}", logEntry);
return LogParseError::messageIdNotInRegistry;
}
@@ -1584,8 +1583,8 @@
if (ec)
{
// TODO Handle for specific error code
- BMCWEB_LOG_ERROR
- << "getLogEntriesIfaceData resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getLogEntriesIfaceData resp_handler got error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1781,8 +1780,8 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR
- << "EventLogEntry (DBus) resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR(
+ "EventLogEntry (DBus) resp_handler got error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1883,7 +1882,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "Set Resolved";
+ BMCWEB_LOG_DEBUG("Set Resolved");
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Logging",
@@ -1892,7 +1891,7 @@
[asyncResp, entryId](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1924,7 +1923,7 @@
systemName);
return;
}
- BMCWEB_LOG_DEBUG << "Do delete single event entries.";
+ BMCWEB_LOG_DEBUG("Do delete single event entries.");
std::string entryID = param;
@@ -1933,7 +1932,7 @@
// Process response from Logging service.
auto respHandler =
[asyncResp, entryID](const boost::system::error_code& ec) {
- BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done";
+ BMCWEB_LOG_DEBUG("EventLogEntry (DBus) doDelete callback: Done");
if (ec)
{
if (ec.value() == EBADR)
@@ -1943,9 +1942,9 @@
return;
}
// TODO Handle for specific error code
- BMCWEB_LOG_ERROR
- << "EventLogEntry (DBus) doDelete respHandler got error "
- << ec;
+ BMCWEB_LOG_ERROR(
+ "EventLogEntry (DBus) doDelete respHandler got error {}",
+ ec);
asyncResp->res.result(
boost::beast::http::status::internal_server_error);
return;
@@ -2011,7 +2010,7 @@
}
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2035,8 +2034,8 @@
constexpr int maxFileSize = 65536;
if (size > maxFileSize)
{
- BMCWEB_LOG_ERROR << "File size exceeds maximum allowed size of "
- << maxFileSize;
+ BMCWEB_LOG_ERROR("File size exceeds maximum allowed size of {}",
+ maxFileSize);
messages::internalError(asyncResp->res);
return;
}
@@ -2080,7 +2079,7 @@
std::filesystem::directory_iterator logPath(hostLoggerFilePath, ec);
if (ec)
{
- BMCWEB_LOG_ERROR << ec.message();
+ BMCWEB_LOG_ERROR("{}", ec.message());
return false;
}
for (const std::filesystem::directory_entry& it : logPath)
@@ -2113,7 +2112,7 @@
{
if (!logFile.gzGetLines(it.string(), skip, top, logEntries, logCount))
{
- BMCWEB_LOG_ERROR << "fail to expose host logs";
+ BMCWEB_LOG_ERROR("fail to expose host logs");
return false;
}
}
@@ -2230,7 +2229,7 @@
std::vector<std::filesystem::path> hostLoggerFiles;
if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
{
- BMCWEB_LOG_ERROR << "fail to get host log file path";
+ BMCWEB_LOG_ERROR("fail to get host log file path");
return;
}
// If we weren't provided top and skip limits, use the defaults.
@@ -2316,7 +2315,7 @@
std::vector<std::filesystem::path> hostLoggerFiles;
if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
{
- BMCWEB_LOG_ERROR << "fail to get host log file path";
+ BMCWEB_LOG_ERROR("fail to get host log file path");
return;
}
@@ -2384,9 +2383,9 @@
const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
if (ec)
{
- BMCWEB_LOG_ERROR
- << "handleBMCLogServicesCollectionGet respHandler got error "
- << ec;
+ BMCWEB_LOG_ERROR(
+ "handleBMCLogServicesCollectionGet respHandler got error {}",
+ ec);
// Assume that getting an error simply means there are no dump
// LogServices. Return without adding any error response.
return;
@@ -2471,8 +2470,8 @@
ret = getJournalMetadata(journal, "SYSLOG_IDENTIFIER", syslogID);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "Failed to read SYSLOG_IDENTIFIER field: "
- << strerror(-ret);
+ BMCWEB_LOG_ERROR("Failed to read SYSLOG_IDENTIFIER field: {}",
+ strerror(-ret));
}
if (!syslogID.empty())
{
@@ -2483,7 +2482,7 @@
ret = getJournalMetadata(journal, "MESSAGE", msg);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "Failed to read MESSAGE field: " << strerror(-ret);
+ BMCWEB_LOG_ERROR("Failed to read MESSAGE field: {}", strerror(-ret));
return 1;
}
message += std::string(msg);
@@ -2493,7 +2492,7 @@
ret = getJournalMetadata(journal, "PRIORITY", 10, severity);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "Failed to read PRIORITY field: " << strerror(-ret);
+ BMCWEB_LOG_ERROR("Failed to read PRIORITY field: {}", strerror(-ret));
}
// Get the Created time from the timestamp
@@ -2559,7 +2558,7 @@
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "failed to open journal: " << strerror(-ret);
+ BMCWEB_LOG_ERROR("failed to open journal: {}", strerror(-ret));
messages::internalError(asyncResp->res);
return;
}
@@ -2630,7 +2629,7 @@
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "failed to open journal: " << strerror(-ret);
+ BMCWEB_LOG_ERROR("failed to open journal: {}", strerror(-ret));
messages::internalError(asyncResp->res);
return;
}
@@ -2644,8 +2643,8 @@
ret = sd_journal_seek_realtime_usec(journal.get(), ts);
if (ret < 0)
{
- BMCWEB_LOG_ERROR << "failed to seek to an entry in journal"
- << strerror(-ret);
+ BMCWEB_LOG_ERROR("failed to seek to an entry in journal{}",
+ strerror(-ret));
messages::internalError(asyncResp->res);
return;
}
@@ -2705,8 +2704,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "getDumpServiceInfo() invalid dump type: "
- << dumpType;
+ BMCWEB_LOG_ERROR("getDumpServiceInfo() invalid dump type: {}",
+ dumpType);
messages::internalError(asyncResp->res);
return;
}
@@ -2741,8 +2740,7 @@
const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
if (ec)
{
- BMCWEB_LOG_ERROR << "getDumpServiceInfo respHandler got error "
- << ec;
+ BMCWEB_LOG_ERROR("getDumpServiceInfo respHandler got error {}", ec);
// Assume that getting an error simply means there are no dump
// LogServices. Return without adding any error response.
return;
@@ -3212,7 +3210,7 @@
const dbus::utility::DBusPropertiesMap& params) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
+ BMCWEB_LOG_DEBUG("failed to get log ec: {}", ec.message());
if (ec.value() ==
boost::system::linux_error::bad_request_descriptor)
{
@@ -3317,8 +3315,8 @@
if (ec.value() !=
boost::system::errc::no_such_file_or_directory)
{
- BMCWEB_LOG_DEBUG << "failed to get entries ec: "
- << ec.message();
+ BMCWEB_LOG_DEBUG("failed to get entries ec: {}",
+ ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -3424,7 +3422,7 @@
resp) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
+ BMCWEB_LOG_DEBUG("failed to get log ec: {}", ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -3536,8 +3534,8 @@
if (diagnosticDataType != "OEM")
{
- BMCWEB_LOG_ERROR
- << "Only OEM DiagnosticDataType supported for Crashdump";
+ BMCWEB_LOG_ERROR(
+ "Only OEM DiagnosticDataType supported for Crashdump");
messages::actionParameterValueFormatError(
asyncResp->res, diagnosticDataType, "DiagnosticDataType",
"CollectDiagnosticData");
@@ -3570,8 +3568,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "Unsupported OEMDiagnosticDataType: "
- << oemDiagnosticDataType;
+ BMCWEB_LOG_ERROR("Unsupported OEMDiagnosticDataType: {}",
+ oemDiagnosticDataType);
messages::actionParameterValueFormatError(
asyncResp->res, oemDiagnosticDataType, "OEMDiagnosticDataType",
"CollectDiagnosticData");
@@ -3660,15 +3658,15 @@
systemName);
return;
}
- BMCWEB_LOG_DEBUG << "Do delete all entries.";
+ BMCWEB_LOG_DEBUG("Do delete all entries.");
// Process response from Logging service.
auto respHandler = [asyncResp](const boost::system::error_code& ec) {
- BMCWEB_LOG_DEBUG << "doClearLog resp_handler callback: Done";
+ BMCWEB_LOG_DEBUG("doClearLog resp_handler callback: Done");
if (ec)
{
// TODO Handle for specific error code
- BMCWEB_LOG_ERROR << "doClearLog resp_handler got error " << ec;
+ BMCWEB_LOG_ERROR("doClearLog resp_handler got error {}", ec);
asyncResp->res.result(
boost::beast::http::status::internal_server_error);
return;
@@ -3766,7 +3764,7 @@
systemName);
return;
}
- BMCWEB_LOG_DEBUG << "Do delete all postcodes entries.";
+ BMCWEB_LOG_DEBUG("Do delete all postcodes entries.");
// Make call to post-code service to request clear all
crow::connections::systemBus->async_method_call(
@@ -3774,8 +3772,8 @@
if (ec)
{
// TODO Handle for specific error code
- BMCWEB_LOG_ERROR << "doClearPostCodes resp_handler got error "
- << ec;
+ BMCWEB_LOG_ERROR("doClearPostCodes resp_handler got error {}",
+ ec);
asyncResp->res.result(
boost::beast::http::status::internal_server_error);
messages::internalError(asyncResp->res);
@@ -3982,7 +3980,7 @@
postcode) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
+ BMCWEB_LOG_DEBUG("DBUS POST CODE PostCode response error");
messages::internalError(asyncResp->res);
return;
}
@@ -4018,7 +4016,7 @@
postcode) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
+ BMCWEB_LOG_DEBUG("DBUS POST CODE PostCode response error");
messages::internalError(asyncResp->res);
return;
}
@@ -4075,7 +4073,7 @@
const uint16_t bootCount) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -4188,7 +4186,7 @@
}
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -4196,7 +4194,7 @@
size_t value = static_cast<size_t>(currentValue) - 1;
if (value == std::string::npos || postcodes.size() < currentValue)
{
- BMCWEB_LOG_WARNING << "Wrong currentValue value";
+ BMCWEB_LOG_WARNING("Wrong currentValue value");
messages::resourceNotFound(asyncResp->res, "LogEntry",
postCodeID);
return;
@@ -4205,7 +4203,7 @@
const auto& [tID, c] = postcodes[value];
if (c.empty())
{
- BMCWEB_LOG_WARNING << "No found post code data";
+ BMCWEB_LOG_WARNING("No found post code data");
messages::resourceNotFound(asyncResp->res, "LogEntry",
postCodeID);
return;
diff --git a/redfish-core/lib/manager_diagnostic_data.hpp b/redfish-core/lib/manager_diagnostic_data.hpp
index ec74231..4dedc3f 100644
--- a/redfish-core/lib/manager_diagnostic_data.hpp
+++ b/redfish-core/lib/manager_diagnostic_data.hpp
@@ -37,7 +37,7 @@
if (runTime < steady_clock::duration::zero())
{
- BMCWEB_LOG_CRITICAL << "Uptime was negative????";
+ BMCWEB_LOG_CRITICAL("Uptime was negative????");
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index c97ba02..a114d44 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -68,7 +68,7 @@
// Use "Set" method to set the property value.
if (ec)
{
- BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -95,7 +95,7 @@
// Use "Set" method to set the property value.
if (ec)
{
- BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -125,7 +125,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "Post Manager Reset.";
+ BMCWEB_LOG_DEBUG("Post Manager Reset.");
std::string resetType;
@@ -137,18 +137,17 @@
if (resetType == "GracefulRestart")
{
- BMCWEB_LOG_DEBUG << "Proceeding with " << resetType;
+ BMCWEB_LOG_DEBUG("Proceeding with {}", resetType);
doBMCGracefulRestart(asyncResp);
return;
}
if (resetType == "ForceRestart")
{
- BMCWEB_LOG_DEBUG << "Proceeding with " << resetType;
+ BMCWEB_LOG_DEBUG("Proceeding with {}", resetType);
doBMCForceRestart(asyncResp);
return;
}
- BMCWEB_LOG_DEBUG << "Invalid property value for ResetType: "
- << resetType;
+ BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", resetType);
messages::actionParameterNotSupported(asyncResp->res, resetType,
"ResetType");
@@ -184,14 +183,14 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "Post ResetToDefaults.";
+ BMCWEB_LOG_DEBUG("Post ResetToDefaults.");
std::string resetType;
if (!json_util::readJsonAction(req, asyncResp->res,
"ResetToDefaultsType", resetType))
{
- BMCWEB_LOG_DEBUG << "Missing property ResetToDefaultsType.";
+ BMCWEB_LOG_DEBUG("Missing property ResetToDefaultsType.");
messages::actionParameterMissing(asyncResp->res, "ResetToDefaults",
"ResetToDefaultsType");
@@ -200,9 +199,9 @@
if (resetType != "ResetAll")
{
- BMCWEB_LOG_DEBUG
- << "Invalid property value for ResetToDefaultsType: "
- << resetType;
+ BMCWEB_LOG_DEBUG(
+ "Invalid property value for ResetToDefaultsType: {}",
+ resetType);
messages::actionParameterNotSupported(asyncResp->res, resetType,
"ResetToDefaultsType");
return;
@@ -212,7 +211,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Failed to ResetToDefaults: " << ec;
+ BMCWEB_LOG_DEBUG("Failed to ResetToDefaults: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -294,7 +293,7 @@
const dbus::utility::ManagedObjectType& managedObj) {
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -327,7 +326,7 @@
{
configRoot["Profile"] = currentProfile;
}
- BMCWEB_LOG_ERROR << "profile = " << currentProfile << " !";
+ BMCWEB_LOG_ERROR("profile = {} !", currentProfile);
for (const auto& pathPair : managedObj)
{
@@ -352,7 +351,7 @@
std::get_if<std::string>(&propPair.second);
if (namePtr == nullptr)
{
- BMCWEB_LOG_ERROR << "Pid Name Field illegal";
+ BMCWEB_LOG_ERROR("Pid Name Field illegal");
messages::internalError(asyncResp->res);
return;
}
@@ -366,15 +365,15 @@
&propPair.second);
if (profiles == nullptr)
{
- BMCWEB_LOG_ERROR << "Pid Profiles Field illegal";
+ BMCWEB_LOG_ERROR("Pid Profiles Field illegal");
messages::internalError(asyncResp->res);
return;
}
if (std::find(profiles->begin(), profiles->end(),
currentProfile) == profiles->end())
{
- BMCWEB_LOG_INFO
- << name << " not supported in current profile";
+ BMCWEB_LOG_INFO(
+ "{} not supported in current profile", name);
continue;
}
}
@@ -416,7 +415,7 @@
{
if (classPtr == nullptr)
{
- BMCWEB_LOG_ERROR << "Pid Class Field illegal";
+ BMCWEB_LOG_ERROR("Pid Class Field illegal");
messages::internalError(asyncResp->res);
return;
}
@@ -439,7 +438,7 @@
{
if (classPtr == nullptr)
{
- BMCWEB_LOG_ERROR << "Pid Class Field illegal";
+ BMCWEB_LOG_ERROR("Pid Class Field illegal");
messages::internalError(asyncResp->res);
return;
}
@@ -467,7 +466,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Unexpected configuration";
+ BMCWEB_LOG_ERROR("Unexpected configuration");
messages::internalError(asyncResp->res);
return;
}
@@ -492,8 +491,8 @@
std::get_if<double>(&propertyPair.second);
if (ptr == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -511,8 +510,8 @@
if (ptr == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -529,8 +528,8 @@
{
if (keys->size() != values->size())
{
- BMCWEB_LOG_ERROR
- << "Reading and Output size don't match ";
+ BMCWEB_LOG_ERROR(
+ "Reading and Output size don't match ");
messages::internalError(asyncResp->res);
return;
}
@@ -552,8 +551,8 @@
std::get_if<double>(&propertyPair.second);
if (ptr == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -573,7 +572,7 @@
if (inputs == nullptr)
{
- BMCWEB_LOG_ERROR << "Zones Pid Field Illegal";
+ BMCWEB_LOG_ERROR("Zones Pid Field Illegal");
messages::internalError(asyncResp->res);
return;
}
@@ -609,8 +608,8 @@
if (inputs == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -623,8 +622,8 @@
if (ptr == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -651,7 +650,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Value Illegal " << *ptr;
+ BMCWEB_LOG_ERROR("Value Illegal {}", *ptr);
messages::internalError(asyncResp->res);
return;
}
@@ -675,8 +674,8 @@
std::get_if<double>(&propertyPair.second);
if (ptr == nullptr)
{
- BMCWEB_LOG_ERROR << "Field Illegal "
- << propertyPair.first;
+ BMCWEB_LOG_ERROR("Field Illegal {}",
+ propertyPair.first);
messages::internalError(asyncResp->res);
return;
}
@@ -703,7 +702,7 @@
{
if (config.empty())
{
- BMCWEB_LOG_ERROR << "Empty Zones";
+ BMCWEB_LOG_ERROR("Empty Zones");
messages::propertyValueFormatError(response->res, config, "Zones");
return false;
}
@@ -722,8 +721,8 @@
// 0 1 2 3 4 5 6 7 8
if (!dbus::utility::getNthStringFromPath(path, 8, input))
{
- BMCWEB_LOG_ERROR << "Got invalid path " << path;
- BMCWEB_LOG_ERROR << "Illegal Type Zones";
+ BMCWEB_LOG_ERROR("Got invalid path {}", path);
+ BMCWEB_LOG_ERROR("Illegal Type Zones");
messages::propertyValueFormatError(response->res, odata, "Zones");
return false;
}
@@ -737,7 +736,7 @@
findChassis(const dbus::utility::ManagedObjectType& managedObj,
const std::string& value, std::string& chassis)
{
- BMCWEB_LOG_DEBUG << "Find Chassis: " << value << "\n";
+ BMCWEB_LOG_DEBUG("Find Chassis: {}", value);
std::string escaped = value;
std::replace(escaped.begin(), escaped.end(), ' ', '_');
@@ -746,7 +745,7 @@
[&escaped](const auto& obj) {
if (boost::algorithm::ends_with(obj.first.str, escaped))
{
- BMCWEB_LOG_DEBUG << "Matched " << obj.first.str << "\n";
+ BMCWEB_LOG_DEBUG("Matched {}", obj.first.str);
return true;
}
return false;
@@ -791,18 +790,18 @@
}
else
{
- BMCWEB_LOG_ERROR << "Illegal Type " << type;
+ BMCWEB_LOG_ERROR("Illegal Type {}", type);
messages::propertyUnknown(response->res, type);
return CreatePIDRet::fail;
}
- BMCWEB_LOG_DEBUG << "del " << path << " " << iface << "\n";
+ BMCWEB_LOG_DEBUG("del {} {}", path, iface);
// delete interface
crow::connections::systemBus->async_method_call(
[response, path](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error patching " << path << ": " << ec;
+ BMCWEB_LOG_ERROR("Error patching {}: {}", path, ec);
messages::internalError(response->res);
return;
}
@@ -820,7 +819,7 @@
managedItem = findChassis(managedObj, it.key(), chassis);
if (managedItem == nullptr)
{
- BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+ BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
messages::invalidObject(
response->res,
boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -862,8 +861,8 @@
&(prop.second));
if (curProfiles == nullptr)
{
- BMCWEB_LOG_ERROR
- << "Illegal profiles in managed object";
+ BMCWEB_LOG_ERROR(
+ "Illegal profiles in managed object");
messages::internalError(response->res);
return CreatePIDRet::fail;
}
@@ -883,8 +882,7 @@
if (!ifaceFound)
{
- BMCWEB_LOG_ERROR
- << "Failed to find interface in managed object";
+ BMCWEB_LOG_ERROR("Failed to find interface in managed object");
messages::internalError(response->res);
return CreatePIDRet::fail;
}
@@ -926,13 +924,13 @@
std::vector<std::string> zonesStr;
if (!getZonesFromJsonReq(response, *zones, zonesStr))
{
- BMCWEB_LOG_ERROR << "Illegal Zones";
+ BMCWEB_LOG_ERROR("Illegal Zones");
return CreatePIDRet::fail;
}
if (chassis.empty() &&
findChassis(managedObj, zonesStr[0], chassis) == nullptr)
{
- BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+ BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
messages::invalidObject(
response->res,
boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -980,8 +978,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Invalid setpointoffset "
- << *setpointOffset;
+ BMCWEB_LOG_ERROR("Invalid setpointoffset {}", *setpointOffset);
messages::propertyValueNotInList(response->res, it.key(),
"SetPointOffset");
return CreatePIDRet::fail;
@@ -995,7 +992,7 @@
{
continue;
}
- BMCWEB_LOG_DEBUG << pairs.first << " = " << *pairs.second;
+ BMCWEB_LOG_DEBUG("{} = {}", pairs.first, *pairs.second);
output.emplace_back(pairs.first, *pairs.second);
}
}
@@ -1027,7 +1024,7 @@
// /redfish/v1/chassis/chassis_name/
if (!dbus::utility::getNthStringFromPath(chassisId, 3, chassis))
{
- BMCWEB_LOG_ERROR << "Got invalid path " << chassisId;
+ BMCWEB_LOG_ERROR("Got invalid path {}", chassisId);
messages::invalidObject(
response->res,
boost::urls::format("/redfish/v1/Chassis/{}", chassisId));
@@ -1067,13 +1064,13 @@
std::vector<std::string> zonesStrs;
if (!getZonesFromJsonReq(response, *zones, zonesStrs))
{
- BMCWEB_LOG_ERROR << "Illegal Zones";
+ BMCWEB_LOG_ERROR("Illegal Zones");
return CreatePIDRet::fail;
}
if (chassis.empty() &&
findChassis(managedObj, zonesStrs[0], chassis) == nullptr)
{
- BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+ BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
messages::invalidObject(
response->res,
boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -1133,7 +1130,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Illegal Type " << type;
+ BMCWEB_LOG_ERROR("Illegal Type {}", type);
messages::propertyUnknown(response->res, type);
return CreatePIDRet::fail;
}
@@ -1169,7 +1166,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtreeLocal) {
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
messages::internalError(self->asyncResp->res);
return;
}
@@ -1191,7 +1188,7 @@
if (subtreeLocal[0].second.size() != 1)
{
// invalid mapper response, should never happen
- BMCWEB_LOG_ERROR << "GetPIDValues: Mapper Error";
+ BMCWEB_LOG_ERROR("GetPIDValues: Mapper Error");
messages::internalError(self->asyncResp->res);
return;
}
@@ -1206,8 +1203,8 @@
const dbus::utility::DBusPropertiesMap& resp) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "GetPIDValues: Can't get thermalModeIface " << path;
+ BMCWEB_LOG_ERROR(
+ "GetPIDValues: Can't get thermalModeIface {}", path);
messages::internalError(self->asyncResp->res);
return;
}
@@ -1227,8 +1224,8 @@
if (current == nullptr || supported == nullptr)
{
- BMCWEB_LOG_ERROR
- << "GetPIDValues: thermal mode iface invalid " << path;
+ BMCWEB_LOG_ERROR(
+ "GetPIDValues: thermal mode iface invalid {}", path);
messages::internalError(self->asyncResp->res);
return;
}
@@ -1280,8 +1277,8 @@
objectMgrPaths.find(connectionGroup.first);
if (findObjMgr == objectMgrPaths.end())
{
- BMCWEB_LOG_DEBUG << connectionGroup.first
- << "Has no Object Manager";
+ BMCWEB_LOG_DEBUG("{}Has no Object Manager",
+ connectionGroup.first);
continue;
}
@@ -1363,7 +1360,7 @@
const dbus::utility::ManagedObjectType& mObj) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error communicating to Entity Manager";
+ BMCWEB_LOG_ERROR("Error communicating to Entity Manager");
messages::internalError(self->asyncResp->res);
return;
}
@@ -1400,7 +1397,7 @@
if (subtree[0].second.empty())
{
// invalid mapper response, should never happen
- BMCWEB_LOG_ERROR << "SetPIDValues: Mapper Error";
+ BMCWEB_LOG_ERROR("SetPIDValues: Mapper Error");
messages::internalError(self->asyncResp->res);
return;
}
@@ -1413,8 +1410,8 @@
const dbus::utility::DBusPropertiesMap& r) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "SetPIDValues: Can't get thermalModeIface " << path;
+ BMCWEB_LOG_ERROR(
+ "SetPIDValues: Can't get thermalModeIface {}", path);
messages::internalError(self->asyncResp->res);
return;
}
@@ -1433,8 +1430,8 @@
if (current == nullptr || supported == nullptr)
{
- BMCWEB_LOG_ERROR
- << "SetPIDValues: thermal mode iface invalid " << path;
+ BMCWEB_LOG_ERROR(
+ "SetPIDValues: thermal mode iface invalid {}", path);
messages::internalError(self->asyncResp->res);
return;
}
@@ -1468,7 +1465,7 @@
[response](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error patching profile" << ec;
+ BMCWEB_LOG_ERROR("Error patching profile{}", ec);
messages::internalError(response->res);
}
});
@@ -1481,7 +1478,7 @@
{
continue;
}
- BMCWEB_LOG_DEBUG << *container;
+ BMCWEB_LOG_DEBUG("{}", *container);
const std::string& type = containerPair.first;
@@ -1491,7 +1488,7 @@
const auto& name = it.key();
std::string dbusObjName = name;
std::replace(dbusObjName.begin(), dbusObjName.end(), ' ', '_');
- BMCWEB_LOG_DEBUG << "looking for " << name;
+ BMCWEB_LOG_DEBUG("looking for {}", name);
auto pathItr = std::find_if(managedObj.begin(),
managedObj.end(),
@@ -1506,7 +1503,7 @@
// determines if we're patching entity-manager or
// creating a new object
bool createNewObject = (pathItr == managedObj.end());
- BMCWEB_LOG_DEBUG << "Found = " << !createNewObject;
+ BMCWEB_LOG_DEBUG("Found = {}", !createNewObject);
std::string iface;
if (!createNewObject)
@@ -1565,7 +1562,7 @@
path = pathItr->first.str;
}
- BMCWEB_LOG_DEBUG << "Create new = " << createNewObject << "\n";
+ BMCWEB_LOG_DEBUG("Create new = {}", createNewObject);
// arbitrary limit to avoid attacks
constexpr const size_t controllerLimit = 500;
@@ -1604,8 +1601,8 @@
const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error patching "
- << propertyName << ": " << ec;
+ BMCWEB_LOG_ERROR("Error patching {}: {}",
+ propertyName, ec);
messages::internalError(response->res);
return;
}
@@ -1617,7 +1614,7 @@
{
if (chassis.empty())
{
- BMCWEB_LOG_ERROR << "Failed to get chassis from config";
+ BMCWEB_LOG_ERROR("Failed to get chassis from config");
messages::internalError(response->res);
return;
}
@@ -1634,7 +1631,7 @@
}
if (!foundChassis)
{
- BMCWEB_LOG_ERROR << "Failed to find chassis on dbus";
+ BMCWEB_LOG_ERROR("Failed to find chassis on dbus");
messages::resourceMissingAtURI(
response->res,
boost::urls::format("/redfish/v1/Chassis/{}",
@@ -1646,8 +1643,7 @@
[response](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error Adding Pid Object "
- << ec;
+ BMCWEB_LOG_ERROR("Error Adding Pid Object {}", ec);
messages::internalError(response->res);
return;
}
@@ -1668,7 +1664,7 @@
}
catch (...)
{
- BMCWEB_LOG_CRITICAL << "pidSetDone threw exception";
+ BMCWEB_LOG_CRITICAL("pidSetDone threw exception");
}
}
@@ -1696,7 +1692,7 @@
const std::string& connectionName,
const std::string& path)
{
- BMCWEB_LOG_DEBUG << "Get BMC manager Location data.";
+ BMCWEB_LOG_DEBUG("Get BMC manager Location data.");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, connectionName, path,
@@ -1705,8 +1701,8 @@
const std::string& property) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error for "
- "Location";
+ BMCWEB_LOG_DEBUG("DBUS response error for "
+ "Location");
messages::internalError(asyncResp->res);
return;
}
@@ -1719,7 +1715,7 @@
inline void
managerGetLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Getting Manager Last Reset Time";
+ BMCWEB_LOG_DEBUG("Getting Manager Last Reset Time");
sdbusplus::asio::getProperty<uint64_t>(
*crow::connections::systemBus, "xyz.openbmc_project.State.BMC",
@@ -1729,7 +1725,7 @@
const uint64_t lastResetTime) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+ BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
return;
}
@@ -1761,7 +1757,7 @@
{
messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget,
"@odata.id");
- BMCWEB_LOG_DEBUG << "Can't parse firmware ID!";
+ BMCWEB_LOG_DEBUG("Can't parse firmware ID!");
return;
}
idPos++;
@@ -1769,7 +1765,7 @@
{
messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget,
"@odata.id");
- BMCWEB_LOG_DEBUG << "Invalid firmware ID.";
+ BMCWEB_LOG_DEBUG("Invalid firmware ID.");
return;
}
std::string firmwareId = runningFirmwareTarget.substr(idPos);
@@ -1783,14 +1779,14 @@
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-Bus response error getting objects.";
+ BMCWEB_LOG_DEBUG("D-Bus response error getting objects.");
messages::internalError(asyncResp->res);
return;
}
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find image!";
+ BMCWEB_LOG_DEBUG("Can't find image!");
messages::internalError(asyncResp->res);
return;
}
@@ -1824,12 +1820,12 @@
{
messages::propertyValueNotInList(
asyncResp->res, runningFirmwareTarget, "@odata.id");
- BMCWEB_LOG_DEBUG << "Invalid firmware ID.";
+ BMCWEB_LOG_DEBUG("Invalid firmware ID.");
return;
}
- BMCWEB_LOG_DEBUG << "Setting firmware version " << firmwareId
- << " to priority 0.";
+ BMCWEB_LOG_DEBUG("Setting firmware version {} to priority 0.",
+ firmwareId);
// Only support Immediate
// An addition could be a Redfish Setting like
@@ -1843,7 +1839,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
+ BMCWEB_LOG_DEBUG("D-Bus response error setting.");
messages::internalError(asyncResp->res);
return;
}
@@ -1855,7 +1851,7 @@
inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
std::string datetime)
{
- BMCWEB_LOG_DEBUG << "Set date time: " << datetime;
+ BMCWEB_LOG_DEBUG("Set date time: {}", datetime);
std::optional<redfish::time_utils::usSinceEpoch> us =
redfish::time_utils::dateStringToEpoch(datetime);
@@ -1873,9 +1869,9 @@
datetime{std::move(datetime)}](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Failed to set elapsed time. "
- "DBUS response error "
- << ec;
+ BMCWEB_LOG_DEBUG("Failed to set elapsed time. "
+ "DBUS response error {}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2058,7 +2054,7 @@
[asyncResp](const boost::system::error_code& ec, double val) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Error while getting progress";
+ BMCWEB_LOG_ERROR("Error while getting progress");
messages::internalError(asyncResp->res);
return;
}
@@ -2080,26 +2076,26 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec;
+ BMCWEB_LOG_DEBUG("D-Bus response error on GetSubTree {}", ec);
return;
}
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find bmc D-Bus object!";
+ BMCWEB_LOG_DEBUG("Can't find bmc D-Bus object!");
return;
}
// Assume only 1 bmc D-Bus object
// Throw an error if there is more than 1
if (subtree.size() > 1)
{
- BMCWEB_LOG_DEBUG << "Found more than 1 bmc D-Bus object!";
+ BMCWEB_LOG_DEBUG("Found more than 1 bmc D-Bus object!");
messages::internalError(asyncResp->res);
return;
}
if (subtree[0].first.empty() || subtree[0].second.size() != 1)
{
- BMCWEB_LOG_DEBUG << "Error getting bmc D-Bus object!";
+ BMCWEB_LOG_DEBUG("Error getting bmc D-Bus object!");
messages::internalError(asyncResp->res);
return;
}
@@ -2120,7 +2116,7 @@
propertiesList) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
+ BMCWEB_LOG_DEBUG("Can't get bmc asset!");
return;
}
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 54b4cca..551a579 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -614,7 +614,7 @@
health->populate();
}
- BMCWEB_LOG_DEBUG << "Get available system components.";
+ BMCWEB_LOG_DEBUG("Get available system components.");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objPath, "",
[dimmId, asyncResp{std::move(asyncResp)}](
@@ -622,7 +622,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -695,7 +695,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
@@ -710,7 +710,7 @@
inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
const std::string& dimmId)
{
- BMCWEB_LOG_DEBUG << "Get available system dimm resources.";
+ BMCWEB_LOG_DEBUG("Get available system dimm resources.");
constexpr std::array<std::string_view, 2> dimmInterfaces = {
"xyz.openbmc_project.Inventory.Item.Dimm",
"xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition"};
@@ -721,7 +721,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index 6f26d8a..7543186 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -108,7 +108,7 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -120,7 +120,7 @@
const telemetry::TimestampReadings& ret) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index e245a99..5daaeba 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -191,16 +191,16 @@
if (path.parent_path() !=
"/xyz/openbmc_project/Telemetry/Triggers/TelemetryService")
{
- BMCWEB_LOG_ERROR << "Property Triggers contains invalid value: "
- << path.str;
+ BMCWEB_LOG_ERROR("Property Triggers contains invalid value: {}",
+ path.str);
return std::nullopt;
}
std::string id = path.filename();
if (id.empty())
{
- BMCWEB_LOG_ERROR << "Property Triggers contains invalid value: "
- << path.str;
+ BMCWEB_LOG_ERROR("Property Triggers contains invalid value: {}",
+ path.str);
return std::nullopt;
}
nlohmann::json::object_t trigger;
@@ -666,9 +666,9 @@
auto el = uriToDbus.find(uri);
if (el == uriToDbus.end())
{
- BMCWEB_LOG_ERROR
- << "Failed to find DBus sensor corresponding to URI "
- << uri;
+ BMCWEB_LOG_ERROR(
+ "Failed to find DBus sensor corresponding to URI {}",
+ uri);
messages::propertyValueNotInList(asyncResp->res, uri,
"MetricProperties/" +
std::to_string(i));
@@ -712,7 +712,7 @@
if (ec)
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
return;
}
@@ -819,7 +819,7 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -855,7 +855,7 @@
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -913,9 +913,9 @@
const std::map<std::string, std::string>& uriToDbus) {
if (status != boost::beast::http::status::ok)
{
- BMCWEB_LOG_ERROR
- << "Failed to retrieve URI to dbus sensors map with err "
- << static_cast<unsigned>(status);
+ BMCWEB_LOG_ERROR(
+ "Failed to retrieve URI to dbus sensors map with err {}",
+ static_cast<unsigned>(status));
return;
}
addReportReq->insert(uriToDbus);
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 29da308..83b6b66 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -351,7 +351,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+ BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index e442c8e..3831e18 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -62,7 +62,7 @@
const dbus::utility::MapperGetObject& object) {
if (ec || object.empty())
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -71,7 +71,7 @@
return;
}
- BMCWEB_LOG_WARNING << "PCIe Device not found";
+ BMCWEB_LOG_WARNING("PCIe Device not found");
messages::resourceNotFound(asyncResp->res, "PCIeDevice", pcieDeviceId);
}
@@ -89,7 +89,7 @@
pcieDevicePaths) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -154,8 +154,8 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error for getAllProperties"
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for getAllProperties{}",
+ ec.value());
messages::internalError(res);
return;
}
@@ -177,13 +177,13 @@
pcie_util::redfishPcieGenerationFromDbus(generation);
if (!pcieType)
{
- BMCWEB_LOG_WARNING << "Unknown PCIeType: " << generation;
+ BMCWEB_LOG_WARNING("Unknown PCIeType: {}", generation);
}
else
{
if (*pcieType == pcie_device::PCIeTypes::Invalid)
{
- BMCWEB_LOG_ERROR << "Invalid PCIeType: " << generation;
+ BMCWEB_LOG_ERROR("Invalid PCIeType: {}", generation);
messages::internalError(res);
return;
}
@@ -199,13 +199,13 @@
pcie_util::dbusSlotTypeToRf(slotType);
if (!redfishSlotType)
{
- BMCWEB_LOG_WARNING << "Unknown PCIeSlot Type: " << slotType;
+ BMCWEB_LOG_WARNING("Unknown PCIeSlot Type: {}", slotType);
}
else
{
if (*redfishSlotType == pcie_slots::SlotTypes::Invalid)
{
- BMCWEB_LOG_ERROR << "Invalid PCIeSlot type: " << slotType;
+ BMCWEB_LOG_ERROR("Invalid PCIeSlot type: {}", slotType);
messages::internalError(res);
return;
}
@@ -232,17 +232,17 @@
// Missing association is not an error
return;
}
- BMCWEB_LOG_ERROR
- << "DBUS response error for getAssociatedSubTreePaths "
- << ec.value();
+ BMCWEB_LOG_ERROR(
+ "DBUS response error for getAssociatedSubTreePaths {}",
+ ec.value());
messages::internalError(asyncResp->res);
return;
}
if (endpoints.size() > 1)
{
- BMCWEB_LOG_ERROR
- << "PCIeDevice is associated with more than one PCIeSlot: "
- << endpoints.size();
+ BMCWEB_LOG_ERROR(
+ "PCIeDevice is associated with more than one PCIeSlot: {}",
+ endpoints.size());
messages::internalError(asyncResp->res);
return;
}
@@ -250,7 +250,7 @@
{
// If the device doesn't have an association, return without PCIe
// Slot properties
- BMCWEB_LOG_DEBUG << "PCIeDevice is not associated with PCIeSlot";
+ BMCWEB_LOG_DEBUG("PCIeDevice is not associated with PCIeSlot");
return;
}
callback(endpoints[0]);
@@ -265,8 +265,8 @@
{
if (ec || object.empty())
{
- BMCWEB_LOG_ERROR << "DBUS response error for getDbusObject "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for getDbusObject {}",
+ ec.value());
messages::internalError(asyncResp->res);
return;
}
@@ -306,8 +306,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Health "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -333,7 +333,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for State";
+ BMCWEB_LOG_ERROR("DBUS response error for State");
messages::internalError(asyncResp->res);
}
return;
@@ -361,8 +361,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Properties"
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -439,15 +439,15 @@
if (!redfishGenerationInUse)
{
- BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
- << *generationInUse;
+ BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}",
+ *generationInUse);
}
else
{
if (*redfishGenerationInUse == pcie_device::PCIeTypes::Invalid)
{
- BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
- << *generationInUse;
+ BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}",
+ *generationInUse);
messages::internalError(asyncResp->res);
return;
}
@@ -463,15 +463,15 @@
if (!redfishGenerationSupported)
{
- BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
- << *generationSupported;
+ BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}",
+ *generationSupported);
}
else
{
if (*redfishGenerationSupported == pcie_device::PCIeTypes::Invalid)
{
- BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
- << *generationSupported;
+ BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}",
+ *generationSupported);
messages::internalError(asyncResp->res);
return;
}
@@ -515,7 +515,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Properties";
+ BMCWEB_LOG_ERROR("DBUS response error for Properties");
messages::internalError(asyncResp->res);
}
return;
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index 4412c41..92ae576 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -29,7 +29,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "Can't get PCIeSlot properties!";
+ BMCWEB_LOG_ERROR("Can't get PCIeSlot properties!");
messages::internalError(asyncResp->res);
return;
}
@@ -40,7 +40,7 @@
slots.get_ptr<nlohmann::json::array_t*>();
if (slotsPtr == nullptr)
{
- BMCWEB_LOG_ERROR << "Slots key isn't an array???";
+ BMCWEB_LOG_ERROR("Slots key isn't an array???");
messages::internalError(asyncResp->res);
return;
}
@@ -69,8 +69,7 @@
pcie_util::redfishPcieGenerationFromDbus(*generation);
if (!pcieType)
{
- BMCWEB_LOG_WARNING << "Unknown PCIe Slot Generation: "
- << *generation;
+ BMCWEB_LOG_WARNING("Unknown PCIe Slot Generation: {}", *generation);
}
else
{
@@ -94,13 +93,13 @@
pcie_util::dbusSlotTypeToRf(*slotType);
if (!redfishSlotType)
{
- BMCWEB_LOG_WARNING << "Unknown PCIe Slot Type: " << *slotType;
+ BMCWEB_LOG_WARNING("Unknown PCIe Slot Type: {}", *slotType);
}
else
{
if (*redfishSlotType == pcie_slots::SlotTypes::Invalid)
{
- BMCWEB_LOG_ERROR << "Unknown PCIe Slot Type: " << *slotType;
+ BMCWEB_LOG_ERROR("Unknown PCIe Slot Type: {}", *slotType);
messages::internalError(asyncResp->res);
return;
}
@@ -129,14 +128,14 @@
// This PCIeSlot have no chassis association.
return;
}
- BMCWEB_LOG_ERROR << "DBUS response error";
+ BMCWEB_LOG_ERROR("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
if (pcieSlotChassis.size() != 1)
{
- BMCWEB_LOG_ERROR << "PCIe Slot association error! ";
+ BMCWEB_LOG_ERROR("PCIe Slot association error! ");
messages::internalError(asyncResp->res);
return;
}
@@ -166,7 +165,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -176,8 +175,8 @@
return;
}
- BMCWEB_LOG_DEBUG << "Get properties for PCIeSlots associated to chassis = "
- << chassisID;
+ BMCWEB_LOG_DEBUG("Get properties for PCIeSlots associated to chassis = {}",
+ chassisID);
asyncResp->res.jsonValue["@odata.type"] = "#PCIeSlots.v1_4_1.PCIeSlots";
asyncResp->res.jsonValue["Name"] = "PCIe Slot Information";
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index f9063b7..e7094ad 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -39,7 +39,7 @@
const std::optional<std::string>& chassisPath) mutable {
if (!chassisPath)
{
- BMCWEB_LOG_WARNING << "Don't find valid chassis path ";
+ BMCWEB_LOG_WARNING("Don't find valid chassis path ");
messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
"Chassis", sensorsAsyncResp->chassisId);
return;
@@ -47,7 +47,7 @@
if (powerControlCollections.size() != 1)
{
- BMCWEB_LOG_WARNING << "Don't support multiple hosts at present ";
+ BMCWEB_LOG_WARNING("Don't support multiple hosts at present ");
messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
"Power", "PowerControl");
return;
@@ -84,8 +84,8 @@
if (ec)
{
messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR << "powerCapEnable Get handler: Dbus error "
- << ec;
+ BMCWEB_LOG_ERROR("powerCapEnable Get handler: Dbus error {}",
+ ec);
return;
}
if (!powerCapEnable)
@@ -93,7 +93,7 @@
messages::actionNotSupported(
sensorsAsyncResp->asyncResp->res,
"Setting LimitInWatts when PowerLimit feature is disabled");
- BMCWEB_LOG_ERROR << "PowerLimit feature is disabled ";
+ BMCWEB_LOG_ERROR("PowerLimit feature is disabled ");
return;
}
@@ -104,7 +104,7 @@
[sensorsAsyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "Power Limit Set: Dbus error: " << ec2;
+ BMCWEB_LOG_DEBUG("Power Limit Set: Dbus error: {}", ec2);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
@@ -148,8 +148,8 @@
const Mapper& chassisPaths) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "Power Limit GetSubTreePaths handler Dbus error " << ec2;
+ BMCWEB_LOG_ERROR(
+ "Power Limit GetSubTreePaths handler Dbus error {}", ec2);
return;
}
@@ -186,8 +186,8 @@
if (!found)
{
- BMCWEB_LOG_DEBUG << "Power Limit not present for "
- << sensorAsyncResp->chassisId;
+ BMCWEB_LOG_DEBUG("Power Limit not present for {}",
+ sensorAsyncResp->chassisId);
return;
}
@@ -198,8 +198,8 @@
if (ec)
{
messages::internalError(sensorAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "Power Limit GetAll handler: Dbus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "Power Limit GetAll handler: Dbus error {}", ec);
return;
}
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index 09f731b..0035b11 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -82,7 +82,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error" << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error{}", ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -171,9 +171,9 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR
- << "DBUS response error for getAssociatedSubTreePaths"
- << ec.value();
+ BMCWEB_LOG_ERROR(
+ "DBUS response error for getAssociatedSubTreePaths{}",
+ ec.value());
messages::internalError(asyncResp->res);
return;
}
@@ -193,7 +193,7 @@
if (!subtreePaths.empty())
{
- BMCWEB_LOG_WARNING << "Power supply not found: " << powerSupplyId;
+ BMCWEB_LOG_WARNING("Power supply not found: {}", powerSupplyId);
messages::resourceNotFound(asyncResp->res, "PowerSupplies",
powerSupplyId);
return;
@@ -213,8 +213,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for State "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for State {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -239,8 +239,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Health "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -266,8 +266,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Asset "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Asset {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -331,8 +331,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for FirmwareVersion "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for FirmwareVersion {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -354,8 +354,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for Location "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for Location {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -373,8 +373,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for DeratingFactor "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for DeratingFactor {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -402,8 +402,8 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "DBUS response error for EfficiencyPercent "
- << ec.value();
+ BMCWEB_LOG_ERROR("DBUS response error for EfficiencyPercent {}",
+ ec.value());
messages::internalError(asyncResp->res);
}
return;
@@ -411,15 +411,15 @@
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+ BMCWEB_LOG_DEBUG("Can't find Power Supply Attributes!");
return;
}
if (subtree.size() != 1)
{
- BMCWEB_LOG_ERROR
- << "Unexpected number of paths returned by getSubTree: "
- << subtree.size();
+ BMCWEB_LOG_ERROR(
+ "Unexpected number of paths returned by getSubTree: {}",
+ subtree.size());
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 8efa78e..873f882 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -59,7 +59,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get Processor UUID";
+ BMCWEB_LOG_DEBUG("Get Processor UUID");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, service, objPath,
"xyz.openbmc_project.Common.UUID", "UUID",
@@ -67,7 +67,7 @@
const boost::system::error_code& ec, const std::string& property) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -79,7 +79,7 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const dbus::utility::DBusInteracesMap& cpuInterfacesProperties)
{
- BMCWEB_LOG_DEBUG << "Get CPU resources by interface.";
+ BMCWEB_LOG_DEBUG("Get CPU resources by interface.");
// Set the default value of state
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -223,7 +223,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get available system cpu resources by service.";
+ BMCWEB_LOG_DEBUG("Get available system cpu resources by service.");
sdbusplus::message::object_path path("/xyz/openbmc_project/inventory");
dbus::utility::getManagedObjects(
@@ -233,7 +233,7 @@
const dbus::utility::ManagedObjectType& dbusData) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -339,7 +339,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "Processor Throttle getAllProperties error " << ec;
+ BMCWEB_LOG_ERROR("Processor Throttle getAllProperties error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -376,7 +376,7 @@
const std::string& service,
const std::string& objectPath)
{
- BMCWEB_LOG_DEBUG << "Get processor throttle resources";
+ BMCWEB_LOG_DEBUG("Get processor throttle resources");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objectPath,
@@ -391,7 +391,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get Cpu Asset Data";
+ BMCWEB_LOG_DEBUG("Get Cpu Asset Data");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objPath,
"xyz.openbmc_project.Inventory.Decorator.Asset",
@@ -400,7 +400,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -465,7 +465,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get Cpu Revision Data";
+ BMCWEB_LOG_DEBUG("Get Cpu Revision Data");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objPath,
"xyz.openbmc_project.Inventory.Decorator.Revision",
@@ -474,7 +474,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -501,8 +501,7 @@
std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& acclrtrId,
const std::string& service, const std::string& objPath)
{
- BMCWEB_LOG_DEBUG
- << "Get available system Accelerator resources by service.";
+ BMCWEB_LOG_DEBUG("Get available system Accelerator resources by service.");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objPath, "",
[acclrtrId, asyncResp{std::move(asyncResp)}](
@@ -510,7 +509,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -613,7 +612,7 @@
const std::string& cpuId, const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_INFO << "Getting CPU operating configs for " << cpuId;
+ BMCWEB_LOG_INFO("Getting CPU operating configs for {}", cpuId);
// First, GetAll CurrentOperatingConfig properties on the object
sdbusplus::asio::getAllProperties(
@@ -624,7 +623,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+ BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -685,7 +684,7 @@
const BaseSpeedPrioritySettingsProperty& baseSpeedList) {
if (ec2)
{
- BMCWEB_LOG_WARNING << "D-Bus Property Get error: " << ec2;
+ BMCWEB_LOG_WARNING("D-Bus Property Get error: {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -714,7 +713,7 @@
const std::string& service,
const std::string& objPath)
{
- BMCWEB_LOG_DEBUG << "Get Cpu Location Data";
+ BMCWEB_LOG_DEBUG("Get Cpu Location Data");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, service, objPath,
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
@@ -722,7 +721,7 @@
const boost::system::error_code& ec, const std::string& property) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -744,7 +743,7 @@
const std::string& service,
const std::string& objectPath)
{
- BMCWEB_LOG_DEBUG << "Get CPU UniqueIdentifier";
+ BMCWEB_LOG_DEBUG("Get CPU UniqueIdentifier");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, service, objectPath,
"xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier",
@@ -753,7 +752,7 @@
const std::string& id) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to read cpu unique id: " << ec;
+ BMCWEB_LOG_ERROR("Failed to read cpu unique id: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -777,7 +776,7 @@
const std::string& processorId,
Handler&& handler)
{
- BMCWEB_LOG_DEBUG << "Get available system processor resources.";
+ BMCWEB_LOG_DEBUG("Get available system processor resources.");
// GetSubTree on all interfaces which provide info about a Processor
constexpr std::array<std::string_view, 9> interfaces = {
@@ -797,7 +796,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error: " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error: {}", ec);
messages::internalError(resp->res);
return;
}
@@ -921,7 +920,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+ BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -1022,11 +1021,11 @@
{
if (!ec)
{
- BMCWEB_LOG_DEBUG << "Set Property succeeded";
+ BMCWEB_LOG_DEBUG("Set Property succeeded");
return;
}
- BMCWEB_LOG_DEBUG << "Set Property failed: " << ec;
+ BMCWEB_LOG_DEBUG("Set Property failed: {}", ec);
const sd_bus_error* dbusError = msg.get_error();
if (dbusError == nullptr)
@@ -1119,7 +1118,7 @@
sdbusplus::message::object_path configPath(cpuObjectPath);
configPath /= configBaseName;
- BMCWEB_LOG_INFO << "Setting config to " << configPath.str;
+ BMCWEB_LOG_INFO("Setting config to {}", configPath.str);
// Set the property, with handler to check error responses
sdbusplus::asio::setProperty(
@@ -1207,8 +1206,7 @@
const dbus::utility::MapperGetSubTreePathsResponse& objects) {
if (ec)
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
- << ec.message();
+ BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
messages::internalError(asyncResp->res);
return;
}
@@ -1281,8 +1279,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
- << ec.message();
+ BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp
index f5c68d1..fad410d 100644
--- a/redfish-core/lib/redfish_util.hpp
+++ b/redfish-core/lib/redfish_util.hpp
@@ -73,12 +73,12 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
return;
}
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find chassis!";
+ BMCWEB_LOG_DEBUG("Can't find chassis!");
return;
}
@@ -87,11 +87,11 @@
(idPos + 1) >= subtree[0].first.size())
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_DEBUG << "Can't parse chassis ID!";
+ BMCWEB_LOG_DEBUG("Can't parse chassis ID!");
return;
}
std::string chassisId = subtree[0].first.substr(idPos + 1);
- BMCWEB_LOG_DEBUG << "chassisId = " << chassisId;
+ BMCWEB_LOG_DEBUG("chassisId = {}", chassisId);
callback(chassisId, asyncResp);
});
}
@@ -109,7 +109,7 @@
std::vector<std::tuple<std::string, std::string, bool>> socketData;
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
// return error code
callback(ec, socketData);
return;
@@ -181,10 +181,9 @@
{
// Already registered as enabled or current one is not
// enabled, nothing to do
- BMCWEB_LOG_DEBUG
- << "protocolName: " << kv.first
- << ", already true or current one is false: "
- << isProtocolEnabled;
+ BMCWEB_LOG_DEBUG(
+ "protocolName: {}, already true or current one is false: {}",
+ kv.first, isProtocolEnabled);
break;
}
// Remove existing entry and replace with new one (below)
@@ -216,7 +215,7 @@
const std::vector<std::tuple<std::string, std::string>>& resp) {
if (ec)
{
- BMCWEB_LOG_ERROR << ec;
+ BMCWEB_LOG_ERROR("{}", ec);
callback(ec, 0);
return;
}
@@ -228,7 +227,7 @@
boost::system::errc::bad_message);
// return error code
callback(ec1, 0);
- BMCWEB_LOG_ERROR << ec1;
+ BMCWEB_LOG_ERROR("{}", ec1);
return;
}
const std::string& listenStream =
@@ -250,7 +249,7 @@
}
// return error code
callback(ec3, 0);
- BMCWEB_LOG_ERROR << ec3;
+ BMCWEB_LOG_ERROR("{}", ec3);
}
callback(ec, port);
});
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index b7a1f4c..a591763 100644
--- a/redfish-core/lib/redfish_v1.hpp
+++ b/redfish-core/lib/redfish_v1.hpp
@@ -39,7 +39,7 @@
return;
}
- BMCWEB_LOG_WARNING << "404 on path " << path;
+ BMCWEB_LOG_WARNING("404 on path {}", path);
std::string name = req.url().segments().back();
// Note, if we hit the wildcard route, we don't know the "type" the user was
@@ -59,7 +59,7 @@
return;
}
- BMCWEB_LOG_WARNING << "405 on path " << path;
+ BMCWEB_LOG_WARNING("405 on path {}", path);
asyncResp->res.result(boost::beast::http::status::method_not_allowed);
if (req.method() == boost::beast::http::verb::delete_)
{
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 1fec868..4969c8f 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -324,7 +324,7 @@
name = path.filename();
if (name.empty())
{
- BMCWEB_LOG_ERROR << "Failed to find '/' in " << objectPath;
+ BMCWEB_LOG_ERROR("Failed to find '/' in {}", objectPath);
}
}
@@ -355,7 +355,7 @@
const std::shared_ptr<std::set<std::string>>& sensorNames,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getObjectsWithConnection enter";
+ BMCWEB_LOG_DEBUG("getObjectsWithConnection enter");
const std::string path = "/xyz/openbmc_project/sensors";
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Sensor.Value"};
@@ -367,26 +367,26 @@
sensorNames](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
// Response handler for parsing objects subtree
- BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
+ BMCWEB_LOG_DEBUG("getObjectsWithConnection resp_handler enter");
if (ec)
{
messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "getObjectsWithConnection resp_handler: Dbus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getObjectsWithConnection resp_handler: Dbus error {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "Found " << subtree.size() << " subtrees";
+ BMCWEB_LOG_DEBUG("Found {} subtrees", subtree.size());
// Make unique list of connections only for requested sensor types and
// found in the chassis
std::set<std::string> connections;
std::set<std::pair<std::string, std::string>> objectsWithConnection;
- BMCWEB_LOG_DEBUG << "sensorNames list count: " << sensorNames->size();
+ BMCWEB_LOG_DEBUG("sensorNames list count: {}", sensorNames->size());
for (const std::string& tsensor : *sensorNames)
{
- BMCWEB_LOG_DEBUG << "Sensor to find: " << tsensor;
+ BMCWEB_LOG_DEBUG("Sensor to find: {}", tsensor);
}
for (const std::pair<
@@ -399,18 +399,18 @@
for (const std::pair<std::string, std::vector<std::string>>&
objData : object.second)
{
- BMCWEB_LOG_DEBUG << "Adding connection: " << objData.first;
+ BMCWEB_LOG_DEBUG("Adding connection: {}", objData.first);
connections.insert(objData.first);
objectsWithConnection.insert(
std::make_pair(object.first, objData.first));
}
}
}
- BMCWEB_LOG_DEBUG << "Found " << connections.size() << " connections";
+ BMCWEB_LOG_DEBUG("Found {} connections", connections.size());
callback(std::move(connections), std::move(objectsWithConnection));
- BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler exit";
+ BMCWEB_LOG_DEBUG("getObjectsWithConnection resp_handler exit");
});
- BMCWEB_LOG_DEBUG << "getObjectsWithConnection exit";
+ BMCWEB_LOG_DEBUG("getObjectsWithConnection exit");
}
/**
@@ -518,7 +518,7 @@
std::span<const std::string_view> sensorTypes,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getChassis enter";
+ BMCWEB_LOG_DEBUG("getChassis enter");
constexpr std::array<std::string_view, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -531,10 +531,10 @@
chassisSubNode{std::string(chassisSubNode)}, sensorTypes](
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse& chassisPaths) {
- BMCWEB_LOG_DEBUG << "getChassis respHandler enter";
+ BMCWEB_LOG_DEBUG("getChassis respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR << "getChassis respHandler DBUS error: " << ec;
+ BMCWEB_LOG_ERROR("getChassis respHandler DBUS error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -545,7 +545,7 @@
std::string chassisName = path.filename();
if (chassisName.empty())
{
- BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+ BMCWEB_LOG_ERROR("Failed to find '/' in {}", chassis);
continue;
}
if (chassisName == chassisIdStr)
@@ -584,11 +584,11 @@
std::make_shared<std::set<std::string>>();
reduceSensorList(asyncResp->res, chassisSubNode, sensorTypes,
&nodeSensorList, culledSensorList);
- BMCWEB_LOG_DEBUG << "Finishing with " << culledSensorList->size();
+ BMCWEB_LOG_DEBUG("Finishing with {}", culledSensorList->size());
callback(culledSensorList);
});
});
- BMCWEB_LOG_DEBUG << "getChassis exit";
+ BMCWEB_LOG_DEBUG("getChassis exit");
}
/**
@@ -774,8 +774,8 @@
sensor::ReadingType readingType = sensors::toReadingType(sensorType);
if (readingType == sensor::ReadingType::Invalid)
{
- BMCWEB_LOG_ERROR << "Redfish cannot map reading type for "
- << sensorType;
+ BMCWEB_LOG_ERROR("Redfish cannot map reading type for {}",
+ sensorType);
}
else
{
@@ -785,8 +785,8 @@
std::string_view readingUnits = sensors::toReadingUnits(sensorType);
if (readingUnits.empty())
{
- BMCWEB_LOG_ERROR << "Redfish cannot map reading unit for "
- << sensorType;
+ BMCWEB_LOG_ERROR("Redfish cannot map reading unit for {}",
+ sensorType);
}
else
{
@@ -843,7 +843,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Redfish cannot map object type for " << sensorName;
+ BMCWEB_LOG_ERROR("Redfish cannot map object type for {}", sensorName);
return;
}
// Map of dbus interface name, dbus property name and redfish property_name
@@ -928,7 +928,7 @@
const double* doubleValue = std::get_if<double>(&valueVariant);
if (doubleValue == nullptr)
{
- BMCWEB_LOG_ERROR << "Got value interface that wasn't double";
+ BMCWEB_LOG_ERROR("Got value interface that wasn't double");
continue;
}
if (!std::isfinite(*doubleValue))
@@ -940,8 +940,8 @@
sensorJson[key] = nullptr;
continue;
}
- BMCWEB_LOG_WARNING << "Sensor value for " << valueName
- << " was unexpectedly " << *doubleValue;
+ BMCWEB_LOG_WARNING("Sensor value for {} was unexpectedly {}",
+ valueName, *doubleValue);
continue;
}
if (forceToInt)
@@ -979,7 +979,7 @@
objectPropertiesToJson(sensorName, sensorType, chassisSubNode,
valuesDict, sensorJson, inventoryItem);
}
- BMCWEB_LOG_DEBUG << "Added sensor " << sensorName;
+ BMCWEB_LOG_DEBUG("Added sensor {}", sensorName);
}
inline void populateFanRedundancy(
@@ -1059,7 +1059,7 @@
if (allowedFailures == nullptr || collection == nullptr ||
status == nullptr)
{
- BMCWEB_LOG_ERROR << "Invalid redundancy interface";
+ BMCWEB_LOG_ERROR("Invalid redundancy interface");
messages::internalError(
sensorsAsyncResp->asyncResp->res);
return;
@@ -1120,7 +1120,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "failed to find fan in schema";
+ BMCWEB_LOG_ERROR("failed to find fan in schema");
messages::internalError(
sensorsAsyncResp->asyncResp->res);
return;
@@ -1432,13 +1432,13 @@
std::shared_ptr<std::set<std::string>> invConnections, Callback&& callback,
size_t invConnectionsIndex = 0)
{
- BMCWEB_LOG_DEBUG << "getInventoryItemsData enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsData enter");
// If no more connections left, call callback
if (invConnectionsIndex >= invConnections->size())
{
callback();
- BMCWEB_LOG_DEBUG << "getInventoryItemsData exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsData exit");
return;
}
@@ -1457,11 +1457,11 @@
callback{std::forward<Callback>(callback)}, invConnectionsIndex](
const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& resp) {
- BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsData respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR
- << "getInventoryItemsData respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getInventoryItemsData respHandler DBus error {}", ec);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
@@ -1487,11 +1487,11 @@
invConnections, std::move(callback),
invConnectionsIndex + 1);
- BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsData respHandler exit");
});
}
- BMCWEB_LOG_DEBUG << "getInventoryItemsData exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsData exit");
}
/**
@@ -1518,7 +1518,7 @@
const std::shared_ptr<std::vector<InventoryItem>>& inventoryItems,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnections enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnections enter");
const std::string path = "/xyz/openbmc_project/inventory";
constexpr std::array<std::string_view, 4> interfaces = {
@@ -1535,12 +1535,12 @@
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
// Response handler for parsing output from GetSubTree
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnections respHandler enter");
if (ec)
{
messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "getInventoryItemsConnections respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getInventoryItemsConnections respHandler DBus error {}", ec);
return;
}
@@ -1569,9 +1569,9 @@
}
callback(invConnections);
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnections respHandler exit");
});
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnections exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnections exit");
}
/**
@@ -1600,7 +1600,7 @@
const std::shared_ptr<std::set<std::string>>& sensorNames,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociations enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociations enter");
// Call GetManagedObjects on the ObjectMapper to get all associations
sdbusplus::message::object_path path("/");
@@ -1609,11 +1609,11 @@
[callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
sensorNames](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& resp) {
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociations respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR
- << "getInventoryItemAssociations respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getInventoryItemAssociations respHandler DBus error {}", ec);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
@@ -1713,10 +1713,10 @@
}
}
callback(inventoryItems);
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociations respHandler exit");
});
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociations exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociations exit");
}
/**
@@ -1755,13 +1755,13 @@
std::shared_ptr<std::map<std::string, std::string>> ledConnections,
Callback&& callback, size_t ledConnectionsIndex = 0)
{
- BMCWEB_LOG_DEBUG << "getInventoryLedData enter";
+ BMCWEB_LOG_DEBUG("getInventoryLedData enter");
// If no more connections left, call callback
if (ledConnectionsIndex >= ledConnections->size())
{
callback();
- BMCWEB_LOG_DEBUG << "getInventoryLedData exit";
+ BMCWEB_LOG_DEBUG("getInventoryLedData exit");
return;
}
@@ -1777,16 +1777,16 @@
[sensorsAsyncResp, inventoryItems, ledConnections, ledPath,
callback{std::forward<Callback>(callback)}, ledConnectionsIndex](
const boost::system::error_code& ec, const std::string& state) {
- BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter";
+ BMCWEB_LOG_DEBUG("getInventoryLedData respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR
- << "getInventoryLedData respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getInventoryLedData respHandler DBus error {}", ec);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Led state: " << state;
+ BMCWEB_LOG_DEBUG("Led state: {}", state);
// Find inventory item with this LED object path
InventoryItem* inventoryItem =
findInventoryItemForLed(*inventoryItems, ledPath);
@@ -1816,7 +1816,7 @@
ledConnections, std::move(callback),
ledConnectionsIndex + 1);
- BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler exit";
+ BMCWEB_LOG_DEBUG("getInventoryLedData respHandler exit");
};
// Get the State property for the current LED
@@ -1826,7 +1826,7 @@
std::move(respHandler));
}
- BMCWEB_LOG_DEBUG << "getInventoryLedData exit";
+ BMCWEB_LOG_DEBUG("getInventoryLedData exit");
}
/**
@@ -1857,7 +1857,7 @@
std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getInventoryLeds enter";
+ BMCWEB_LOG_DEBUG("getInventoryLeds enter");
const std::string path = "/xyz/openbmc_project";
constexpr std::array<std::string_view, 1> interfaces = {
@@ -1871,12 +1871,11 @@
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
// Response handler for parsing output from GetSubTree
- BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler enter";
+ BMCWEB_LOG_DEBUG("getInventoryLeds respHandler enter");
if (ec)
{
messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR << "getInventoryLeds respHandler DBus error "
- << ec;
+ BMCWEB_LOG_ERROR("getInventoryLeds respHandler DBus error {}", ec);
return;
}
@@ -1898,16 +1897,15 @@
// Add mapping from ledPath to connection
const std::string& connection = object.second.begin()->first;
(*ledConnections)[ledPath] = connection;
- BMCWEB_LOG_DEBUG << "Added mapping " << ledPath << " -> "
- << connection;
+ BMCWEB_LOG_DEBUG("Added mapping {} -> {}", ledPath, connection);
}
}
getInventoryLedData(sensorsAsyncResp, inventoryItems, ledConnections,
std::move(callback));
- BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler exit";
+ BMCWEB_LOG_DEBUG("getInventoryLeds respHandler exit");
});
- BMCWEB_LOG_DEBUG << "getInventoryLeds exit";
+ BMCWEB_LOG_DEBUG("getInventoryLeds exit");
}
/**
@@ -1941,11 +1939,11 @@
const std::map<std::string, std::string>& psAttributesConnections,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData enter";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData enter");
if (psAttributesConnections.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find PowerSupplyAttributes, no connections!";
+ BMCWEB_LOG_DEBUG("Can't find PowerSupplyAttributes, no connections!");
callback(inventoryItems);
return;
}
@@ -1961,16 +1959,16 @@
[sensorsAsyncResp, inventoryItems,
callback{std::forward<Callback>(callback)}](
const boost::system::error_code& ec, const uint32_t value) {
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler enter";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData respHandler enter");
if (ec)
{
- BMCWEB_LOG_ERROR
- << "getPowerSupplyAttributesData respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getPowerSupplyAttributesData respHandler DBus error {}", ec);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "PS EfficiencyPercent value: " << value;
+ BMCWEB_LOG_DEBUG("PS EfficiencyPercent value: {}", value);
// Store value in Power Supply Inventory Items
for (InventoryItem& inventoryItem : *inventoryItems)
{
@@ -1981,7 +1979,7 @@
}
}
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler exit";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData respHandler exit");
callback(inventoryItems);
};
@@ -1992,7 +1990,7 @@
"xyz.openbmc_project.Control.PowerSupplyAttributes", "DeratingFactor",
std::move(respHandler));
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData exit";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData exit");
}
/**
@@ -2024,12 +2022,12 @@
std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes enter";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributes enter");
// Only need the power supply attributes when the Power Schema
if (sensorsAsyncResp->chassisSubNode != sensors::node::power)
{
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes exit since not Power";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributes exit since not Power");
callback(inventoryItems);
return;
}
@@ -2045,17 +2043,17 @@
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
// Response handler for parsing output from GetSubTree
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributes respHandler enter");
if (ec)
{
messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "getPowerSupplyAttributes respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "getPowerSupplyAttributes respHandler DBus error {}", ec);
return;
}
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+ BMCWEB_LOG_DEBUG("Can't find Power Supply Attributes!");
callback(inventoryItems);
return;
}
@@ -2067,7 +2065,7 @@
if (subtree[0].first.empty() || subtree[0].second.empty())
{
- BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+ BMCWEB_LOG_DEBUG("Power Supply Attributes mapper error!");
callback(inventoryItems);
return;
}
@@ -2077,21 +2075,21 @@
if (connection.empty())
{
- BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+ BMCWEB_LOG_DEBUG("Power Supply Attributes mapper error!");
callback(inventoryItems);
return;
}
psAttributesConnections[psAttributesPath] = connection;
- BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
- << connection;
+ BMCWEB_LOG_DEBUG("Added mapping {} -> {}", psAttributesPath,
+ connection);
getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
psAttributesConnections,
std::move(callback));
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributes respHandler exit");
});
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes exit";
+ BMCWEB_LOG_DEBUG("getPowerSupplyAttributes exit");
}
/**
@@ -2122,52 +2120,52 @@
const std::shared_ptr<std::set<std::string>> sensorNames,
Callback&& callback)
{
- BMCWEB_LOG_DEBUG << "getInventoryItems enter";
+ BMCWEB_LOG_DEBUG("getInventoryItems enter");
auto getInventoryItemAssociationsCb =
[sensorsAsyncResp, callback{std::forward<Callback>(callback)}](
std::shared_ptr<std::vector<InventoryItem>> inventoryItems) {
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociationsCb enter");
auto getInventoryItemsConnectionsCb =
[sensorsAsyncResp, inventoryItems,
callback{std::forward<const Callback>(callback)}](
std::shared_ptr<std::set<std::string>> invConnections) {
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnectionsCb enter");
auto getInventoryItemsDataCb = [sensorsAsyncResp, inventoryItems,
callback{std::move(callback)}]() {
- BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsDataCb enter");
auto getInventoryLedsCb = [sensorsAsyncResp, inventoryItems,
callback{std::move(callback)}]() {
- BMCWEB_LOG_DEBUG << "getInventoryLedsCb enter";
+ BMCWEB_LOG_DEBUG("getInventoryLedsCb enter");
// Find Power Supply Attributes and get the data
getPowerSupplyAttributes(sensorsAsyncResp, inventoryItems,
std::move(callback));
- BMCWEB_LOG_DEBUG << "getInventoryLedsCb exit";
+ BMCWEB_LOG_DEBUG("getInventoryLedsCb exit");
};
// Find led connections and get the data
getInventoryLeds(sensorsAsyncResp, inventoryItems,
std::move(getInventoryLedsCb));
- BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsDataCb exit");
};
// Get inventory item data from connections
getInventoryItemsData(sensorsAsyncResp, inventoryItems,
invConnections,
std::move(getInventoryItemsDataCb));
- BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsConnectionsCb exit");
};
// Get connections that provide inventory item data
getInventoryItemsConnections(sensorsAsyncResp, inventoryItems,
std::move(getInventoryItemsConnectionsCb));
- BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemAssociationsCb exit");
};
// Get associations from sensors to inventory items
getInventoryItemAssociations(sensorsAsyncResp, sensorNames,
std::move(getInventoryItemAssociationsCb));
- BMCWEB_LOG_DEBUG << "getInventoryItems exit";
+ BMCWEB_LOG_DEBUG("getInventoryItems exit");
}
/**
@@ -2258,7 +2256,7 @@
const std::set<std::string>& connections,
const std::shared_ptr<std::vector<InventoryItem>>& inventoryItems)
{
- BMCWEB_LOG_DEBUG << "getSensorData enter";
+ BMCWEB_LOG_DEBUG("getSensorData enter");
// Get managed objects from all services exposing sensors
for (const std::string& connection : connections)
{
@@ -2269,10 +2267,10 @@
[sensorsAsyncResp, sensorNames,
inventoryItems](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& resp) {
- BMCWEB_LOG_DEBUG << "getManagedObjectsCb enter";
+ BMCWEB_LOG_DEBUG("getManagedObjectsCb enter");
if (ec)
{
- BMCWEB_LOG_ERROR << "getManagedObjectsCb DBUS error: " << ec;
+ BMCWEB_LOG_ERROR("getManagedObjectsCb DBUS error: {}", ec);
messages::internalError(sensorsAsyncResp->asyncResp->res);
return;
}
@@ -2281,8 +2279,8 @@
{
const std::string& objPath =
static_cast<const std::string&>(objDictEntry.first);
- BMCWEB_LOG_DEBUG << "getManagedObjectsCb parsing object "
- << objPath;
+ BMCWEB_LOG_DEBUG("getManagedObjectsCb parsing object {}",
+ objPath);
std::vector<std::string> split;
// Reserve space for
@@ -2292,19 +2290,19 @@
bmcweb::split(split, objPath, '/');
if (split.size() < 6)
{
- BMCWEB_LOG_ERROR << "Got path that isn't long enough "
- << objPath;
+ BMCWEB_LOG_ERROR("Got path that isn't long enough {}",
+ objPath);
continue;
}
// These indexes aren't intuitive, as split puts an empty
// string at the beginning
const std::string& sensorType = split[4];
const std::string& sensorName = split[5];
- BMCWEB_LOG_DEBUG << "sensorName " << sensorName
- << " sensorType " << sensorType;
+ BMCWEB_LOG_DEBUG("sensorName {} sensorType {}", sensorName,
+ sensorType);
if (sensorNames->find(objPath) == sensorNames->end())
{
- BMCWEB_LOG_DEBUG << sensorName << " not in sensor list ";
+ BMCWEB_LOG_DEBUG("{} not in sensor list ", sensorName);
continue;
}
@@ -2375,8 +2373,8 @@
}
else
{
- BMCWEB_LOG_ERROR << "Unsure how to handle sensorType "
- << sensorType;
+ BMCWEB_LOG_ERROR("Unsure how to handle sensorType {}",
+ sensorType);
continue;
}
@@ -2476,10 +2474,10 @@
populateFanRedundancy(sensorsAsyncResp);
}
}
- BMCWEB_LOG_DEBUG << "getManagedObjectsCb exit";
+ BMCWEB_LOG_DEBUG("getManagedObjectsCb exit");
});
}
- BMCWEB_LOG_DEBUG << "getSensorData exit";
+ BMCWEB_LOG_DEBUG("getSensorData exit");
}
inline void
@@ -2488,23 +2486,23 @@
{
auto getConnectionCb = [sensorsAsyncResp, sensorNames](
const std::set<std::string>& connections) {
- BMCWEB_LOG_DEBUG << "getConnectionCb enter";
+ BMCWEB_LOG_DEBUG("getConnectionCb enter");
auto getInventoryItemsCb =
[sensorsAsyncResp, sensorNames,
connections](const std::shared_ptr<std::vector<InventoryItem>>&
inventoryItems) {
- BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
+ BMCWEB_LOG_DEBUG("getInventoryItemsCb enter");
// Get sensor data and store results in JSON
getSensorData(sensorsAsyncResp, sensorNames, connections,
inventoryItems);
- BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
+ BMCWEB_LOG_DEBUG("getInventoryItemsCb exit");
};
// Get inventory items associated with sensors
getInventoryItems(sensorsAsyncResp, sensorNames,
std::move(getInventoryItemsCb));
- BMCWEB_LOG_DEBUG << "getConnectionCb exit";
+ BMCWEB_LOG_DEBUG("getConnectionCb exit");
};
// Get set of connections that provide sensor values
@@ -2519,13 +2517,13 @@
inline void
getChassisData(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
{
- BMCWEB_LOG_DEBUG << "getChassisData enter";
+ BMCWEB_LOG_DEBUG("getChassisData enter");
auto getChassisCb =
[sensorsAsyncResp](
const std::shared_ptr<std::set<std::string>>& sensorNames) {
- BMCWEB_LOG_DEBUG << "getChassisCb enter";
+ BMCWEB_LOG_DEBUG("getChassisCb enter");
processSensorList(sensorsAsyncResp, sensorNames);
- BMCWEB_LOG_DEBUG << "getChassisCb exit";
+ BMCWEB_LOG_DEBUG("getChassisCb exit");
};
// SensorCollection doesn't contain the Redundancy property
if (sensorsAsyncResp->chassisSubNode != sensors::node::sensors)
@@ -2537,7 +2535,7 @@
getChassis(sensorsAsyncResp->asyncResp, sensorsAsyncResp->chassisId,
sensorsAsyncResp->chassisSubNode, sensorsAsyncResp->types,
std::move(getChassisCb));
- BMCWEB_LOG_DEBUG << "getChassisData exit";
+ BMCWEB_LOG_DEBUG("getChassisData exit");
}
/**
@@ -2601,8 +2599,8 @@
std::unordered_map<std::string, std::vector<nlohmann::json>>&
allCollections)
{
- BMCWEB_LOG_INFO << "setSensorsOverride for subNode"
- << sensorAsyncResp->chassisSubNode << "\n";
+ BMCWEB_LOG_INFO("setSensorsOverride for subNode{}",
+ sensorAsyncResp->chassisSubNode);
const char* propertyValueName = nullptr;
std::unordered_map<std::string, std::pair<double, std::string>> overrideMap;
@@ -2650,7 +2648,7 @@
if (!findSensorNameUsingSensorPath(sensorNameType.second,
*sensorsList, *sensorNames))
{
- BMCWEB_LOG_INFO << "Unable to find memberId " << item.first;
+ BMCWEB_LOG_INFO("Unable to find memberId {}", item.first);
messages::resourceNotFound(sensorAsyncResp->asyncResp->res,
item.second.second, item.first);
return;
@@ -2664,10 +2662,9 @@
objectsWithConnection) {
if (objectsWithConnection.size() != overrideMap.size())
{
- BMCWEB_LOG_INFO
- << "Unable to find all objects with proper connection "
- << objectsWithConnection.size() << " requested "
- << overrideMap.size() << "\n";
+ BMCWEB_LOG_INFO(
+ "Unable to find all objects with proper connection {} requested {}",
+ objectsWithConnection.size(), overrideMap.size());
messages::resourceNotFound(sensorAsyncResp->asyncResp->res,
sensorAsyncResp->chassisSubNode ==
sensors::node::thermal
@@ -2689,8 +2686,8 @@
const auto& iterator = overrideMap.find(sensorName);
if (iterator == overrideMap.end())
{
- BMCWEB_LOG_INFO << "Unable to find sensor object"
- << item.first << "\n";
+ BMCWEB_LOG_INFO("Unable to find sensor object{}",
+ item.first);
messages::internalError(sensorAsyncResp->asyncResp->res);
return;
}
@@ -2704,16 +2701,16 @@
if (ec.value() ==
boost::system::errc::permission_denied)
{
- BMCWEB_LOG_WARNING
- << "Manufacturing mode is not Enabled...can't "
- "Override the sensor value. ";
+ BMCWEB_LOG_WARNING(
+ "Manufacturing mode is not Enabled...can't "
+ "Override the sensor value. ");
messages::insufficientPrivilege(
sensorAsyncResp->asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG
- << "setOverrideValueStatus DBUS error: " << ec;
+ BMCWEB_LOG_DEBUG(
+ "setOverrideValueStatus DBUS error: {}", ec);
messages::internalError(
sensorAsyncResp->asyncResp->res);
}
@@ -2751,7 +2748,7 @@
[&node](auto&& val) { return val.first == node; });
if (pathIt == sensors::paths.cend())
{
- BMCWEB_LOG_ERROR << "Wrong node provided : " << node;
+ BMCWEB_LOG_ERROR("Wrong node provided : {}", node);
mapComplete(boost::beast::http::status::bad_request, {});
return;
}
@@ -2776,18 +2773,18 @@
std::string_view chassisId, std::string_view chassisSubNode,
const std::shared_ptr<std::set<std::string>>& sensorNames)
{
- BMCWEB_LOG_DEBUG << "getChassisCallback enter ";
+ BMCWEB_LOG_DEBUG("getChassisCallback enter ");
nlohmann::json& entriesArray = asyncResp->res.jsonValue["Members"];
for (const std::string& sensor : *sensorNames)
{
- BMCWEB_LOG_DEBUG << "Adding sensor: " << sensor;
+ BMCWEB_LOG_DEBUG("Adding sensor: {}", sensor);
sdbusplus::message::object_path path(sensor);
std::string sensorName = path.filename();
if (sensorName.empty())
{
- BMCWEB_LOG_ERROR << "Invalid sensor path: " << sensor;
+ BMCWEB_LOG_ERROR("Invalid sensor path: {}", sensor);
messages::internalError(asyncResp->res);
return;
}
@@ -2807,7 +2804,7 @@
}
asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size();
- BMCWEB_LOG_DEBUG << "getChassisCallback exit";
+ BMCWEB_LOG_DEBUG("getChassisCallback exit");
}
inline void handleSensorCollectionGet(
@@ -2834,8 +2831,8 @@
/*efficientExpand=*/true);
getChassisData(sensorsAsyncResp);
- BMCWEB_LOG_DEBUG
- << "SensorCollection doGet exit via efficient expand handler";
+ BMCWEB_LOG_DEBUG(
+ "SensorCollection doGet exit via efficient expand handler");
return;
}
@@ -2858,8 +2855,8 @@
}
const auto& valueIface = *mapperResponse.begin();
const std::string& connectionName = valueIface.first;
- BMCWEB_LOG_DEBUG << "Looking up " << connectionName;
- BMCWEB_LOG_DEBUG << "Path " << sensorPath;
+ BMCWEB_LOG_DEBUG("Looking up {}", connectionName);
+ BMCWEB_LOG_DEBUG("Path {}", sensorPath);
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, connectionName, sensorPath, "",
@@ -2900,7 +2897,7 @@
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
"/redfish/v1/Chassis/{}/Sensors/{}", chassisId, sensorId);
- BMCWEB_LOG_DEBUG << "Sensor doGet enter";
+ BMCWEB_LOG_DEBUG("Sensor doGet enter");
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Sensor.Value"};
@@ -2913,22 +2910,22 @@
[asyncResp, sensorId,
sensorPath](const boost::system::error_code& ec,
const ::dbus::utility::MapperGetObject& subtree) {
- BMCWEB_LOG_DEBUG << "respHandler1 enter";
+ BMCWEB_LOG_DEBUG("respHandler1 enter");
if (ec == boost::system::errc::io_error)
{
- BMCWEB_LOG_WARNING << "Sensor not found from getSensorPaths";
+ BMCWEB_LOG_WARNING("Sensor not found from getSensorPaths");
messages::resourceNotFound(asyncResp->res, sensorId, "Sensor");
return;
}
if (ec)
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "Sensor getSensorPaths resp_handler: "
- << "Dbus error " << ec;
+ BMCWEB_LOG_ERROR(
+ "Sensor getSensorPaths resp_handler: Dbus error {}", ec);
return;
}
getSensorFromDbus(asyncResp, sensorPath, subtree);
- BMCWEB_LOG_DEBUG << "respHandler1 exit";
+ BMCWEB_LOG_DEBUG("respHandler1 exit");
});
}
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 6b60ae7..1f41ea8 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -110,7 +110,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "Drive mapper call error";
+ BMCWEB_LOG_ERROR("Drive mapper call error");
messages::internalError(asyncResp->res);
return;
}
@@ -131,7 +131,7 @@
sdbusplus::message::object_path object(drive);
if (object.filename().empty())
{
- BMCWEB_LOG_ERROR << "Failed to find filename in " << drive;
+ BMCWEB_LOG_ERROR("Failed to find filename in {}", drive);
return;
}
@@ -161,7 +161,7 @@
{
if (ec)
{
- BMCWEB_LOG_DEBUG << "requestRoutesStorage DBUS response error";
+ BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error");
messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage",
storageId);
return;
@@ -230,7 +230,7 @@
{
if (ec)
{
- BMCWEB_LOG_DEBUG << "requestRoutesStorage DBUS response error";
+ BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error");
messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage",
storageId);
return;
@@ -274,7 +274,7 @@
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
- BMCWEB_LOG_DEBUG << "requestRoutesStorage setUpRedfishRoute failed";
+ BMCWEB_LOG_DEBUG("requestRoutesStorage setUpRedfishRoute failed");
return;
}
@@ -478,7 +478,7 @@
if (value == nullptr)
{
// illegal property
- BMCWEB_LOG_ERROR << "Illegal property: Type";
+ BMCWEB_LOG_ERROR("Illegal property: Type");
messages::internalError(asyncResp->res);
return;
}
@@ -487,8 +487,8 @@
convertDriveType(*value);
if (!mediaType)
{
- BMCWEB_LOG_WARNING << "UnknownDriveType Interface: "
- << *value;
+ BMCWEB_LOG_WARNING("UnknownDriveType Interface: {}",
+ *value);
continue;
}
if (*mediaType == drive::MediaType::Invalid)
@@ -505,7 +505,7 @@
std::get_if<uint64_t>(&property.second);
if (capacity == nullptr)
{
- BMCWEB_LOG_ERROR << "Illegal property: Capacity";
+ BMCWEB_LOG_ERROR("Illegal property: Capacity");
messages::internalError(asyncResp->res);
return;
}
@@ -523,7 +523,7 @@
std::get_if<std::string>(&property.second);
if (value == nullptr)
{
- BMCWEB_LOG_ERROR << "Illegal property: Protocol";
+ BMCWEB_LOG_ERROR("Illegal property: Protocol");
messages::internalError(asyncResp->res);
return;
}
@@ -532,8 +532,8 @@
convertDriveProtocol(*value);
if (!proto)
{
- BMCWEB_LOG_WARNING << "Unknown DrivePrototype Interface: "
- << *value;
+ BMCWEB_LOG_WARNING("Unknown DrivePrototype Interface: {}",
+ *value);
continue;
}
if (*proto == protocol::Protocol::Invalid)
@@ -549,8 +549,8 @@
std::get_if<uint8_t>(&property.second);
if (lifeLeft == nullptr)
{
- BMCWEB_LOG_ERROR
- << "Illegal property: PredictedMediaLifeLeftPercent";
+ BMCWEB_LOG_ERROR(
+ "Illegal property: PredictedMediaLifeLeftPercent");
messages::internalError(asyncResp->res);
return;
}
@@ -566,7 +566,7 @@
encryptionStatus = std::get_if<std::string>(&property.second);
if (encryptionStatus == nullptr)
{
- BMCWEB_LOG_ERROR << "Illegal property: EncryptionStatus";
+ BMCWEB_LOG_ERROR("Illegal property: EncryptionStatus");
messages::internalError(asyncResp->res);
return;
}
@@ -576,7 +576,7 @@
isLocked = std::get_if<bool>(&property.second);
if (isLocked == nullptr)
{
- BMCWEB_LOG_ERROR << "Illegal property: Locked";
+ BMCWEB_LOG_ERROR("Illegal property: Locked");
messages::internalError(asyncResp->res);
return;
}
@@ -646,7 +646,7 @@
{
if (ec)
{
- BMCWEB_LOG_ERROR << "Drive mapper call error";
+ BMCWEB_LOG_ERROR("Drive mapper call error");
messages::internalError(asyncResp->res);
return;
}
@@ -676,8 +676,8 @@
if (connectionNames.size() != 1)
{
- BMCWEB_LOG_ERROR << "Connection size " << connectionNames.size()
- << ", not equal to 1";
+ BMCWEB_LOG_ERROR("Connection size {}, not equal to 1",
+ connectionNames.size());
messages::internalError(asyncResp->res);
return;
}
@@ -770,7 +770,7 @@
if (connectionNames.empty())
{
- BMCWEB_LOG_ERROR << "Got 0 Connection names";
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
continue;
}
@@ -787,7 +787,7 @@
const dbus::utility::MapperEndPoints& resp) {
if (ec3)
{
- BMCWEB_LOG_ERROR << "Error in chassis Drive association ";
+ BMCWEB_LOG_ERROR("Error in chassis Drive association ");
}
nlohmann::json& members = asyncResp->res.jsonValue["Members"];
// important if array is empty
@@ -856,7 +856,7 @@
{
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -872,7 +872,7 @@
if (connectionNames.empty())
{
- BMCWEB_LOG_ERROR << "Got 0 Connection names";
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
continue;
}
@@ -959,7 +959,7 @@
if (connectionNames.empty())
{
- BMCWEB_LOG_ERROR << "Got 0 Connection names";
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
continue;
}
@@ -999,7 +999,7 @@
if (ec)
{
// this interface isn't necessary
- BMCWEB_LOG_DEBUG << "Failed to get StorageControllerAsset";
+ BMCWEB_LOG_DEBUG("Failed to get StorageControllerAsset");
return;
}
@@ -1058,7 +1058,7 @@
// if we get a good return
if (ec)
{
- BMCWEB_LOG_DEBUG << "Failed to get Present property";
+ BMCWEB_LOG_DEBUG("Failed to get Present property");
return;
}
if (!isPresent)
@@ -1086,7 +1086,7 @@
if (ec || subtree.empty())
{
// doesn't have to be there
- BMCWEB_LOG_DEBUG << "Failed to handle StorageController";
+ BMCWEB_LOG_DEBUG("Failed to handle StorageController");
return;
}
@@ -1096,7 +1096,7 @@
std::string id = object.filename();
if (id.empty())
{
- BMCWEB_LOG_ERROR << "Failed to find filename in " << path;
+ BMCWEB_LOG_ERROR("Failed to find filename in {}", path);
return;
}
if (id != controllerId)
@@ -1106,8 +1106,8 @@
if (interfaceDict.size() != 1)
{
- BMCWEB_LOG_ERROR << "Connection size " << interfaceDict.size()
- << ", greater than 1";
+ BMCWEB_LOG_ERROR("Connection size {}, greater than 1",
+ interfaceDict.size());
messages::internalError(asyncResp->res);
return;
}
@@ -1128,7 +1128,7 @@
{
asyncResp->res.jsonValue["Members"] = std::move(members);
asyncResp->res.jsonValue["Members@odata.count"] = 0;
- BMCWEB_LOG_DEBUG << "Failed to find any StorageController";
+ BMCWEB_LOG_DEBUG("Failed to find any StorageController");
return;
}
@@ -1137,7 +1137,7 @@
std::string id = sdbusplus::message::object_path(path).filename();
if (id.empty())
{
- BMCWEB_LOG_ERROR << "Failed to find filename in " << path;
+ BMCWEB_LOG_ERROR("Failed to find filename in {}", path);
return;
}
nlohmann::json::object_t member;
@@ -1156,15 +1156,15 @@
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
- BMCWEB_LOG_DEBUG
- << "Failed to setup Redfish Route for StorageController Collection";
+ BMCWEB_LOG_DEBUG(
+ "Failed to setup Redfish Route for StorageController Collection");
return;
}
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
- BMCWEB_LOG_DEBUG << "Failed to find ComputerSystem of " << systemName;
+ BMCWEB_LOG_DEBUG("Failed to find ComputerSystem of {}", systemName);
return;
}
@@ -1192,15 +1192,14 @@
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
- BMCWEB_LOG_DEBUG
- << "Failed to setup Redfish Route for StorageController";
+ BMCWEB_LOG_DEBUG("Failed to setup Redfish Route for StorageController");
return;
}
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
- BMCWEB_LOG_DEBUG << "Failed to find ComputerSystem of " << systemName;
+ BMCWEB_LOG_DEBUG("Failed to find ComputerSystem of {}", systemName);
return;
}
constexpr std::array<std::string_view, 1> interfaces = {
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 69ef490..609af71 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -64,7 +64,7 @@
updateDimmProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
bool isDimmFunctional)
{
- BMCWEB_LOG_DEBUG << "Dimm Functional: " << isDimmFunctional;
+ BMCWEB_LOG_DEBUG("Dimm Functional: {}", isDimmFunctional);
// Set it as Enabled if at least one DIMM is functional
// Update STATE only if previous State was DISABLED and current Dimm is
@@ -93,7 +93,7 @@
inline void modifyCpuFunctionalState(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, bool isCpuFunctional)
{
- BMCWEB_LOG_DEBUG << "Cpu Functional: " << isCpuFunctional;
+ BMCWEB_LOG_DEBUG("Cpu Functional: {}", isCpuFunctional);
const nlohmann::json& prevProcState =
asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"];
@@ -123,7 +123,7 @@
modifyCpuPresenceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
bool isCpuPresent)
{
- BMCWEB_LOG_DEBUG << "Cpu Present: " << isCpuPresent;
+ BMCWEB_LOG_DEBUG("Cpu Present: {}", isCpuPresent);
if (isCpuPresent)
{
@@ -144,7 +144,7 @@
const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
properties)
{
- BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties.";
+ BMCWEB_LOG_DEBUG("Got {} Cpu properties.", properties.size());
// TODO: Get Model
@@ -193,7 +193,7 @@
const bool cpuPresenceCheck) {
if (ec3)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
return;
}
modifyCpuPresenceState(asyncResp, cpuPresenceCheck);
@@ -212,7 +212,7 @@
const bool cpuFunctionalCheck) {
if (ec3)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
return;
}
modifyCpuFunctionalState(asyncResp, cpuFunctionalCheck);
@@ -233,7 +233,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec2;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -257,7 +257,7 @@
[[maybe_unused]] const std::string& path,
const dbus::utility::DBusPropertiesMap& properties)
{
- BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Dimm properties.";
+ BMCWEB_LOG_DEBUG("Got {} Dimm properties.", properties.size());
if (properties.empty())
{
@@ -272,7 +272,7 @@
bool dimmState) {
if (ec3)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
return;
}
updateDimmProperties(asyncResp, dimmState);
@@ -338,7 +338,7 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "DBUS response error " << ec2;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -358,7 +358,7 @@
getComputerSystem(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::shared_ptr<HealthPopulate>& systemHealth)
{
- BMCWEB_LOG_DEBUG << "Get available system components.";
+ BMCWEB_LOG_DEBUG("Get available system components.");
constexpr std::array<std::string_view, 5> interfaces = {
"xyz.openbmc_project.Inventory.Decorator.Asset",
"xyz.openbmc_project.Inventory.Item.Cpu",
@@ -373,7 +373,7 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
messages::internalError(asyncResp->res);
return;
}
@@ -384,7 +384,7 @@
object : subtree)
{
const std::string& path = object.first;
- BMCWEB_LOG_DEBUG << "Got path: " << path;
+ BMCWEB_LOG_DEBUG("Got path: {}", path);
const std::vector<std::pair<std::string, std::vector<std::string>>>&
connectionNames = object.second;
if (connectionNames.empty())
@@ -419,8 +419,7 @@
if (interfaceName ==
"xyz.openbmc_project.Inventory.Item.Dimm")
{
- BMCWEB_LOG_DEBUG
- << "Found Dimm, now get its properties.";
+ BMCWEB_LOG_DEBUG("Found Dimm, now get its properties.");
getMemorySummary(asyncResp, connection.first, path);
@@ -432,8 +431,7 @@
else if (interfaceName ==
"xyz.openbmc_project.Inventory.Item.Cpu")
{
- BMCWEB_LOG_DEBUG
- << "Found Cpu, now get its properties.";
+ BMCWEB_LOG_DEBUG("Found Cpu, now get its properties.");
getProcessorSummary(asyncResp, connection.first, path);
@@ -444,8 +442,7 @@
}
else if (interfaceName == "xyz.openbmc_project.Common.UUID")
{
- BMCWEB_LOG_DEBUG
- << "Found UUID, now get its properties.";
+ BMCWEB_LOG_DEBUG("Found UUID, now get its properties.");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, connection.first,
@@ -455,13 +452,12 @@
properties) {
if (ec3)
{
- BMCWEB_LOG_DEBUG << "DBUS response error "
- << ec3;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec3);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Got " << properties.size()
- << " UUID properties.";
+ BMCWEB_LOG_DEBUG("Got {} UUID properties.",
+ properties.size());
const std::string* uUID = nullptr;
@@ -486,7 +482,7 @@
valueStr.insert(18, 1, '-');
valueStr.insert(23, 1, '-');
}
- BMCWEB_LOG_DEBUG << "UUID = " << valueStr;
+ BMCWEB_LOG_DEBUG("UUID = {}", valueStr);
asyncResp->res.jsonValue["UUID"] = valueStr;
}
});
@@ -507,8 +503,8 @@
// interface
return;
}
- BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
- << " properties for system";
+ BMCWEB_LOG_DEBUG("Got {} properties for system",
+ propertiesList.size());
const std::string* partNumber = nullptr;
const std::string* serialNumber = nullptr;
@@ -598,7 +594,7 @@
*/
inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get host information.";
+ BMCWEB_LOG_DEBUG("Get host information.");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.State.Host",
"/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host",
@@ -611,15 +607,15 @@
{
// Service not available, no error, just don't return
// host state info
- BMCWEB_LOG_DEBUG << "Service not available " << ec;
+ BMCWEB_LOG_DEBUG("Service not available {}", ec);
return;
}
- BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Host state: " << hostState;
+ BMCWEB_LOG_DEBUG("Host state: {}", hostState);
// Verify Host State
if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
{
@@ -814,8 +810,7 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Unsupported D-Bus BootProgress "
- << dbusBootProgress;
+ BMCWEB_LOG_DEBUG("Unsupported D-Bus BootProgress {}", dbusBootProgress);
// Just return the default
}
return rfBpLastState;
@@ -870,9 +865,9 @@
}
else
{
- BMCWEB_LOG_DEBUG
- << "Invalid property value for BootSourceOverrideTarget: "
- << bootSource;
+ BMCWEB_LOG_DEBUG(
+ "Invalid property value for BootSourceOverrideTarget: {}",
+ bootSource);
messages::propertyValueNotInList(asyncResp->res, rfSource,
"BootSourceTargetOverride");
return -1;
@@ -902,7 +897,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Boot Progress: " << bootProgressStr;
+ BMCWEB_LOG_DEBUG("Boot Progress: {}", bootProgressStr);
asyncResp->res.jsonValue["BootProgress"]["LastState"] =
dbusToRfBootProgress(bootProgressStr);
@@ -927,7 +922,7 @@
const uint64_t lastStateTime) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+ BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
return;
}
@@ -966,7 +961,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Boot type: " << bootType;
+ BMCWEB_LOG_DEBUG("Boot type: {}", bootType);
asyncResp->res
.jsonValue["Boot"]
@@ -1003,12 +998,12 @@
const std::string& bootModeStr) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot mode: " << bootModeStr;
+ BMCWEB_LOG_DEBUG("Boot mode: {}", bootModeStr);
asyncResp->res
.jsonValue["Boot"]
@@ -1047,7 +1042,7 @@
const std::string& bootSourceStr) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
if (ec.value() == boost::asio::error::host_unreachable)
{
return;
@@ -1056,7 +1051,7 @@
return;
}
- BMCWEB_LOG_DEBUG << "Boot source: " << bootSourceStr;
+ BMCWEB_LOG_DEBUG("Boot source: {}", bootSourceStr);
auto rfSource = dbusToRfBootSource(bootSourceStr);
if (!rfSource.empty())
@@ -1101,7 +1096,7 @@
[asyncResp](const boost::system::error_code& ec, bool oneTimeSetting) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1138,7 +1133,7 @@
const bool bootOverrideEnable) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
if (ec.value() == boost::asio::error::host_unreachable)
{
return;
@@ -1161,7 +1156,7 @@
inline void
getBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get boot information.";
+ BMCWEB_LOG_DEBUG("Get boot information.");
getBootOverrideSource(asyncResp);
getBootOverrideType(asyncResp);
@@ -1183,7 +1178,7 @@
inline void
getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Getting System Last Reset Time";
+ BMCWEB_LOG_DEBUG("Getting System Last Reset Time");
sdbusplus::asio::getProperty<uint64_t>(
*crow::connections::systemBus, "xyz.openbmc_project.State.Chassis",
@@ -1193,7 +1188,7 @@
uint64_t lastResetTime) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+ BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
return;
}
@@ -1222,7 +1217,7 @@
inline void getAutomaticRebootAttempts(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
+ BMCWEB_LOG_DEBUG("Get Automatic Retry policy");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, "xyz.openbmc_project.State.Host",
@@ -1235,7 +1230,7 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
}
return;
@@ -1279,7 +1274,7 @@
inline void
getAutomaticRetryPolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
+ BMCWEB_LOG_DEBUG("Get Automatic Retry policy");
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1291,13 +1286,13 @@
{
if (ec.value() != EBADR)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
}
return;
}
- BMCWEB_LOG_DEBUG << "Auto Reboot: " << autoRebootEnabled;
+ BMCWEB_LOG_DEBUG("Auto Reboot: {}", autoRebootEnabled);
if (autoRebootEnabled)
{
asyncResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] =
@@ -1332,7 +1327,7 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const uint32_t retryAttempts)
{
- BMCWEB_LOG_DEBUG << "Set Automatic Retry Attempts.";
+ BMCWEB_LOG_DEBUG("Set Automatic Retry Attempts.");
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.State.Host",
"/xyz/openbmc_project/state/host0",
@@ -1340,9 +1335,8 @@
retryAttempts, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR
- << "DBUS response error: Set setAutomaticRetryAttempts"
- << ec;
+ BMCWEB_LOG_ERROR(
+ "DBUS response error: Set setAutomaticRetryAttempts{}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1383,7 +1377,7 @@
inline void
getPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get power restore policy";
+ BMCWEB_LOG_DEBUG("Get power restore policy");
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1393,7 +1387,7 @@
const std::string& policy) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
return;
}
computer_system::PowerRestorePolicyTypes restore =
@@ -1418,7 +1412,7 @@
inline void
getStopBootOnFault(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get Stop Boot On Fault";
+ BMCWEB_LOG_DEBUG("Get Stop Boot On Fault");
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1456,7 +1450,7 @@
inline void getTrustedModuleRequiredToBoot(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get TPM required to boot.";
+ BMCWEB_LOG_DEBUG("Get TPM required to boot.");
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Control.TPM.Policy"};
dbus::utility::getSubTree(
@@ -1465,8 +1459,8 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree"
- << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error on TPM.Policy GetSubTree{}",
+ ec);
// This is an optional D-Bus object so just return if
// error occurs
return;
@@ -1481,9 +1475,9 @@
/* When there is more than one TPMEnable object... */
if (subtree.size() > 1)
{
- BMCWEB_LOG_DEBUG
- << "DBUS response has more than 1 TPM Enable object:"
- << subtree.size();
+ BMCWEB_LOG_DEBUG(
+ "DBUS response has more than 1 TPM Enable object:{}",
+ subtree.size());
// Throw an internal Error and return
messages::internalError(asyncResp->res);
return;
@@ -1493,7 +1487,7 @@
// field
if (subtree[0].first.empty() || subtree[0].second.size() != 1)
{
- BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!";
+ BMCWEB_LOG_DEBUG("TPM.Policy mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -1509,8 +1503,8 @@
bool tpmRequired) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get"
- << ec2;
+ BMCWEB_LOG_DEBUG("D-BUS response error on TPM.Policy Get{}",
+ ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -1543,7 +1537,7 @@
inline void setTrustedModuleRequiredToBoot(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool tpmRequired)
{
- BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot.";
+ BMCWEB_LOG_DEBUG("Set TrustedModuleRequiredToBoot.");
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Control.TPM.Policy"};
dbus::utility::getSubTree(
@@ -1553,8 +1547,8 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree"
- << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error on TPM.Policy GetSubTree{}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1568,9 +1562,9 @@
/* When there is more than one TPMEnable object... */
if (subtree.size() > 1)
{
- BMCWEB_LOG_DEBUG
- << "DBUS response has more than 1 TPM Enable object:"
- << subtree.size();
+ BMCWEB_LOG_DEBUG(
+ "DBUS response has more than 1 TPM Enable object:{}",
+ subtree.size());
// Throw an internal Error and return
messages::internalError(asyncResp->res);
return;
@@ -1580,7 +1574,7 @@
// field
if (subtree[0].first.empty() || subtree[0].second.size() != 1)
{
- BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!";
+ BMCWEB_LOG_DEBUG("TPM.Policy mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -1590,7 +1584,7 @@
if (serv.empty())
{
- BMCWEB_LOG_DEBUG << "TPM.Policy service mapper error!";
+ BMCWEB_LOG_DEBUG("TPM.Policy service mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -1602,13 +1596,13 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG
- << "DBUS response error: Set TrustedModuleRequiredToBoot"
- << ec2;
+ BMCWEB_LOG_DEBUG(
+ "DBUS response error: Set TrustedModuleRequiredToBoot{}",
+ ec2);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot done.";
+ BMCWEB_LOG_DEBUG("Set TrustedModuleRequiredToBoot done.");
});
});
}
@@ -1631,7 +1625,7 @@
}
// Source target specified
- BMCWEB_LOG_DEBUG << "Boot type: " << *bootType;
+ BMCWEB_LOG_DEBUG("Boot type: {}", *bootType);
// Figure out which DBUS interface and property to use
if (*bootType == "Legacy")
{
@@ -1643,16 +1637,16 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Invalid property value for "
- "BootSourceOverrideMode: "
- << *bootType;
+ BMCWEB_LOG_DEBUG("Invalid property value for "
+ "BootSourceOverrideMode: {}",
+ *bootType);
messages::propertyValueNotInList(asyncResp->res, *bootType,
"BootSourceOverrideMode");
return;
}
// Act on validated parameters
- BMCWEB_LOG_DEBUG << "DBUS boot type: " << bootTypeStr;
+ BMCWEB_LOG_DEBUG("DBUS boot type: {}", bootTypeStr);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1661,7 +1655,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
if (ec.value() == boost::asio::error::host_unreachable)
{
messages::resourceNotFound(asyncResp->res, "Set", "BootType");
@@ -1670,7 +1664,7 @@
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot type update done.";
+ BMCWEB_LOG_DEBUG("Boot type update done.");
});
}
@@ -1690,7 +1684,7 @@
return;
}
// Source target specified
- BMCWEB_LOG_DEBUG << "Boot enable: " << *bootEnable;
+ BMCWEB_LOG_DEBUG("Boot enable: {}", *bootEnable);
bool bootOverrideEnable = false;
bool bootOverridePersistent = false;
@@ -1711,16 +1705,16 @@
}
else
{
- BMCWEB_LOG_DEBUG
- << "Invalid property value for BootSourceOverrideEnabled: "
- << *bootEnable;
+ BMCWEB_LOG_DEBUG(
+ "Invalid property value for BootSourceOverrideEnabled: {}",
+ *bootEnable);
messages::propertyValueNotInList(asyncResp->res, *bootEnable,
"BootSourceOverrideEnabled");
return;
}
// Act on validated parameters
- BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable;
+ BMCWEB_LOG_DEBUG("DBUS boot override enable: {}", bootOverrideEnable);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1729,11 +1723,11 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot override enable update done.";
+ BMCWEB_LOG_DEBUG("Boot override enable update done.");
});
if (!bootOverrideEnable)
@@ -1743,8 +1737,8 @@
// In case boot override is enabled we need to set correct value for the
// 'one_time' enable DBus interface
- BMCWEB_LOG_DEBUG << "DBUS boot override persistent: "
- << bootOverridePersistent;
+ BMCWEB_LOG_DEBUG("DBUS boot override persistent: {}",
+ bootOverridePersistent);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1753,11 +1747,11 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot one_time update done.";
+ BMCWEB_LOG_DEBUG("Boot one_time update done.");
});
}
@@ -1782,22 +1776,22 @@
}
// Source target specified
- BMCWEB_LOG_DEBUG << "Boot source: " << *bootSource;
+ BMCWEB_LOG_DEBUG("Boot source: {}", *bootSource);
// Figure out which DBUS interface and property to use
if (assignBootParameters(asyncResp, *bootSource, bootSourceStr,
bootModeStr) != 0)
{
- BMCWEB_LOG_DEBUG
- << "Invalid property value for BootSourceOverrideTarget: "
- << *bootSource;
+ BMCWEB_LOG_DEBUG(
+ "Invalid property value for BootSourceOverrideTarget: {}",
+ *bootSource);
messages::propertyValueNotInList(asyncResp->res, *bootSource,
"BootSourceTargetOverride");
return;
}
// Act on validated parameters
- BMCWEB_LOG_DEBUG << "DBUS boot source: " << bootSourceStr;
- BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr;
+ BMCWEB_LOG_DEBUG("DBUS boot source: {}", bootSourceStr);
+ BMCWEB_LOG_DEBUG("DBUS boot mode: {}", bootModeStr);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1806,11 +1800,11 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot source update done.";
+ BMCWEB_LOG_DEBUG("Boot source update done.");
});
sdbusplus::asio::setProperty(
@@ -1820,11 +1814,11 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Boot mode update done.";
+ BMCWEB_LOG_DEBUG("Boot mode update done.");
});
}
@@ -1845,7 +1839,7 @@
const std::optional<std::string>& bootType,
const std::optional<std::string>& bootEnable)
{
- BMCWEB_LOG_DEBUG << "Set boot information.";
+ BMCWEB_LOG_DEBUG("Set boot information.");
setBootModeOrSource(asyncResp, bootSource);
setBootType(asyncResp, bootType);
@@ -1872,13 +1866,13 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec;
+ BMCWEB_LOG_DEBUG("D-Bus response error on GetSubTree {}", ec);
messages::internalError(asyncResp->res);
return;
}
if (subtree.empty())
{
- BMCWEB_LOG_DEBUG << "Can't find system D-Bus object!";
+ BMCWEB_LOG_DEBUG("Can't find system D-Bus object!");
messages::internalError(asyncResp->res);
return;
}
@@ -1886,13 +1880,13 @@
// Throw an error if there is more than 1
if (subtree.size() > 1)
{
- BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus object!";
+ BMCWEB_LOG_DEBUG("Found more than 1 system D-Bus object!");
messages::internalError(asyncResp->res);
return;
}
if (subtree[0].first.empty() || subtree[0].second.size() != 1)
{
- BMCWEB_LOG_DEBUG << "Asset Tag Set mapper error!";
+ BMCWEB_LOG_DEBUG("Asset Tag Set mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -1902,7 +1896,7 @@
if (service.empty())
{
- BMCWEB_LOG_DEBUG << "Asset Tag Set service mapper error!";
+ BMCWEB_LOG_DEBUG("Asset Tag Set service mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -1913,8 +1907,8 @@
assetTag, [asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "D-Bus response error on AssetTag Set "
- << ec2;
+ BMCWEB_LOG_DEBUG("D-Bus response error on AssetTag Set {}",
+ ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -1958,13 +1952,13 @@
inline void setStopBootOnFault(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
const std::string& stopBootOnFault)
{
- BMCWEB_LOG_DEBUG << "Set Stop Boot On Fault.";
+ BMCWEB_LOG_DEBUG("Set Stop Boot On Fault.");
std::optional<bool> stopBootEnabled = validstopBootOnFault(stopBootOnFault);
if (!stopBootEnabled)
{
- BMCWEB_LOG_DEBUG << "Invalid property value for StopBootOnFault: "
- << stopBootOnFault;
+ BMCWEB_LOG_DEBUG("Invalid property value for StopBootOnFault: {}",
+ stopBootOnFault);
messages::propertyValueNotInList(aResp->res, stopBootOnFault,
"StopBootOnFault");
return;
@@ -1999,7 +1993,7 @@
setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& automaticRetryConfig)
{
- BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
+ BMCWEB_LOG_DEBUG("Set Automatic Retry.");
// OpenBMC only supports "Disabled" and "RetryAttempts".
bool autoRebootEnabled = false;
@@ -2014,8 +2008,8 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Invalid property value for AutomaticRetryConfig: "
- << automaticRetryConfig;
+ BMCWEB_LOG_DEBUG("Invalid property value for AutomaticRetryConfig: {}",
+ automaticRetryConfig);
messages::propertyValueNotInList(asyncResp->res, automaticRetryConfig,
"AutomaticRetryConfig");
return;
@@ -2063,7 +2057,7 @@
setPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
std::string_view policy)
{
- BMCWEB_LOG_DEBUG << "Set power restore policy.";
+ BMCWEB_LOG_DEBUG("Set power restore policy.");
std::string powerRestorePolicy = dbusPowerRestorePolicyFromRedfish(policy);
@@ -2097,7 +2091,7 @@
*/
inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get OEM information.";
+ BMCWEB_LOG_DEBUG("Get OEM information.");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, "xyz.openbmc_project.PFR.Manager",
"/xyz/openbmc_project/pfr", "xyz.openbmc_project.PFR.Attributes",
@@ -2111,7 +2105,7 @@
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
// not an error, don't have to have the interface
oemPFR["ProvisioningStatus"] = "NotProvisioned";
return;
@@ -2132,7 +2126,7 @@
if ((provState == nullptr) || (lockState == nullptr))
{
- BMCWEB_LOG_DEBUG << "Unable to get PFR attributes.";
+ BMCWEB_LOG_DEBUG("Unable to get PFR attributes.");
messages::internalError(asyncResp->res);
return;
}
@@ -2191,7 +2185,7 @@
else
{
// Any other values would be invalid
- BMCWEB_LOG_DEBUG << "PowerMode value was not valid: " << modeValue;
+ BMCWEB_LOG_DEBUG("PowerMode value was not valid: {}", modeValue);
messages::internalError(asyncResp->res);
}
}
@@ -2205,7 +2199,7 @@
*/
inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get power mode.";
+ BMCWEB_LOG_DEBUG("Get power mode.");
// Get Power Mode object path:
constexpr std::array<std::string_view, 1> interfaces = {
@@ -2216,8 +2210,8 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree "
- << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error on Power.Mode GetSubTree {}",
+ ec);
// This is an optional D-Bus object so just return if
// error occurs
return;
@@ -2232,15 +2226,15 @@
{
// More then one PowerMode object is not supported and is an
// error
- BMCWEB_LOG_DEBUG
- << "Found more than 1 system D-Bus Power.Mode objects: "
- << subtree.size();
+ BMCWEB_LOG_DEBUG(
+ "Found more than 1 system D-Bus Power.Mode objects: {}",
+ subtree.size());
messages::internalError(asyncResp->res);
return;
}
if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
{
- BMCWEB_LOG_DEBUG << "Power.Mode mapper error!";
+ BMCWEB_LOG_DEBUG("Power.Mode mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2248,7 +2242,7 @@
const std::string& service = subtree[0].second.begin()->first;
if (service.empty())
{
- BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!";
+ BMCWEB_LOG_DEBUG("Power.Mode service mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2260,8 +2254,8 @@
const std::string& pmode) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: "
- << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error on PowerMode Get: {}",
+ ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2269,7 +2263,7 @@
asyncResp->res.jsonValue["PowerMode@Redfish.AllowableValues"] = {
"Static", "MaximumPerformance", "PowerSaving"};
- BMCWEB_LOG_DEBUG << "Current power mode: " << pmode;
+ BMCWEB_LOG_DEBUG("Current power mode: {}", pmode);
translatePowerMode(asyncResp, pmode);
});
});
@@ -2322,7 +2316,7 @@
inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& pmode)
{
- BMCWEB_LOG_DEBUG << "Set power mode.";
+ BMCWEB_LOG_DEBUG("Set power mode.");
std::string powerMode = validatePowerMode(asyncResp, pmode);
if (powerMode.empty())
@@ -2340,8 +2334,8 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree "
- << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error on Power.Mode GetSubTree {}",
+ ec);
// This is an optional D-Bus object, but user attempted to patch
messages::internalError(asyncResp->res);
return;
@@ -2357,15 +2351,15 @@
{
// More then one PowerMode object is not supported and is an
// error
- BMCWEB_LOG_DEBUG
- << "Found more than 1 system D-Bus Power.Mode objects: "
- << subtree.size();
+ BMCWEB_LOG_DEBUG(
+ "Found more than 1 system D-Bus Power.Mode objects: {}",
+ subtree.size());
messages::internalError(asyncResp->res);
return;
}
if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
{
- BMCWEB_LOG_DEBUG << "Power.Mode mapper error!";
+ BMCWEB_LOG_DEBUG("Power.Mode mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2373,13 +2367,12 @@
const std::string& service = subtree[0].second.begin()->first;
if (service.empty())
{
- BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!";
+ BMCWEB_LOG_DEBUG("Power.Mode service mapper error!");
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "Setting power mode(" << powerMode << ") -> "
- << path;
+ BMCWEB_LOG_DEBUG("Setting power mode({}) -> {}", powerMode, path);
// Set the Power Mode property
sdbusplus::asio::setProperty(
@@ -2466,7 +2459,7 @@
inline void
getHostWatchdogTimer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get host watchodg";
+ BMCWEB_LOG_DEBUG("Get host watchodg");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, "xyz.openbmc_project.Watchdog",
"/xyz/openbmc_project/watchdog/host0",
@@ -2476,11 +2469,11 @@
if (ec)
{
// watchdog service is stopped
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
return;
}
- BMCWEB_LOG_DEBUG << "Got " << properties.size() << " wdt prop.";
+ BMCWEB_LOG_DEBUG("Got {} wdt prop.", properties.size());
nlohmann::json& hostWatchdogTimer =
asyncResp->res.jsonValue["HostWatchdogTimer"];
@@ -2534,7 +2527,7 @@
const std::optional<bool> wdtEnable,
const std::optional<std::string>& wdtTimeOutAction)
{
- BMCWEB_LOG_DEBUG << "Set host watchdog";
+ BMCWEB_LOG_DEBUG("Set host watchdog");
if (wdtTimeOutAction)
{
@@ -2542,8 +2535,8 @@
// check if TimeOut Action is Valid
if (wdtTimeOutActStr.empty())
{
- BMCWEB_LOG_DEBUG << "Unsupported value for TimeoutAction: "
- << *wdtTimeOutAction;
+ BMCWEB_LOG_DEBUG("Unsupported value for TimeoutAction: {}",
+ *wdtTimeOutAction);
messages::propertyValueNotInList(asyncResp->res, *wdtTimeOutAction,
"TimeoutAction");
return;
@@ -2556,7 +2549,7 @@
wdtTimeOutActStr, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2572,7 +2565,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2655,7 +2648,7 @@
inline void
getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- BMCWEB_LOG_DEBUG << "Get idle power saver parameters";
+ BMCWEB_LOG_DEBUG("Get idle power saver parameters");
// Get IdlePowerSaver object path:
constexpr std::array<std::string_view, 1> interfaces = {
@@ -2666,9 +2659,9 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG
- << "DBUS response error on Power.IdlePowerSaver GetSubTree "
- << ec;
+ BMCWEB_LOG_DEBUG(
+ "DBUS response error on Power.IdlePowerSaver GetSubTree {}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2676,22 +2669,22 @@
{
// This is an optional interface so just return
// if there is no instance found
- BMCWEB_LOG_DEBUG << "No instances found";
+ BMCWEB_LOG_DEBUG("No instances found");
return;
}
if (subtree.size() > 1)
{
// More then one PowerIdlePowerSaver object is not supported and
// is an error
- BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus "
- "Power.IdlePowerSaver objects: "
- << subtree.size();
+ BMCWEB_LOG_DEBUG("Found more than 1 system D-Bus "
+ "Power.IdlePowerSaver objects: {}",
+ subtree.size());
messages::internalError(asyncResp->res);
return;
}
if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
{
- BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!";
+ BMCWEB_LOG_DEBUG("Power.IdlePowerSaver mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2699,7 +2692,7 @@
const std::string& service = subtree[0].second.begin()->first;
if (service.empty())
{
- BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!";
+ BMCWEB_LOG_DEBUG("Power.IdlePowerSaver service mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2712,8 +2705,8 @@
const dbus::utility::DBusPropertiesMap& properties) {
if (ec2)
{
- BMCWEB_LOG_ERROR
- << "DBUS response error on IdlePowerSaver GetAll: " << ec2;
+ BMCWEB_LOG_ERROR(
+ "DBUS response error on IdlePowerSaver GetAll: {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2726,7 +2719,7 @@
});
});
- BMCWEB_LOG_DEBUG << "EXIT: Get idle power saver parameters";
+ BMCWEB_LOG_DEBUG("EXIT: Get idle power saver parameters");
}
/**
@@ -2752,7 +2745,7 @@
const std::optional<uint8_t> ipsExitUtil,
const std::optional<uint64_t> ipsExitTime)
{
- BMCWEB_LOG_DEBUG << "Set idle power saver properties";
+ BMCWEB_LOG_DEBUG("Set idle power saver properties");
// Get IdlePowerSaver object path:
constexpr std::array<std::string_view, 1> interfaces = {
@@ -2764,9 +2757,9 @@
const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG
- << "DBUS response error on Power.IdlePowerSaver GetSubTree "
- << ec;
+ BMCWEB_LOG_DEBUG(
+ "DBUS response error on Power.IdlePowerSaver GetSubTree {}",
+ ec);
messages::internalError(asyncResp->res);
return;
}
@@ -2781,15 +2774,15 @@
{
// More then one PowerIdlePowerSaver object is not supported and
// is an error
- BMCWEB_LOG_DEBUG
- << "Found more than 1 system D-Bus Power.IdlePowerSaver objects: "
- << subtree.size();
+ BMCWEB_LOG_DEBUG(
+ "Found more than 1 system D-Bus Power.IdlePowerSaver objects: {}",
+ subtree.size());
messages::internalError(asyncResp->res);
return;
}
if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
{
- BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!";
+ BMCWEB_LOG_DEBUG("Power.IdlePowerSaver mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2797,7 +2790,7 @@
const std::string& service = subtree[0].second.begin()->first;
if (service.empty())
{
- BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!";
+ BMCWEB_LOG_DEBUG("Power.IdlePowerSaver service mapper error!");
messages::internalError(asyncResp->res);
return;
}
@@ -2813,7 +2806,7 @@
*ipsEnable, [asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2828,7 +2821,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2845,7 +2838,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2860,7 +2853,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2877,7 +2870,7 @@
[asyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
messages::internalError(asyncResp->res);
return;
}
@@ -2885,7 +2878,7 @@
}
});
- BMCWEB_LOG_DEBUG << "EXIT: Set idle power saver parameters";
+ BMCWEB_LOG_DEBUG("EXIT: Set idle power saver parameters");
}
inline void handleComputerSystemCollectionHead(
@@ -2943,17 +2936,17 @@
auto val = asyncResp->res.jsonValue.find("Members@odata.count");
if (val == asyncResp->res.jsonValue.end())
{
- BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+ BMCWEB_LOG_CRITICAL("Count wasn't found??");
return;
}
uint64_t* count = val->get_ptr<uint64_t*>();
if (count == nullptr)
{
- BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+ BMCWEB_LOG_CRITICAL("Count wasn't found??");
return;
}
*count = *count + 1;
- BMCWEB_LOG_DEBUG << "Hypervisor is available";
+ BMCWEB_LOG_DEBUG("Hypervisor is available");
nlohmann::json& ifaceArray2 = asyncResp->res.jsonValue["Members"];
nlohmann::json::object_t hypervisor;
hypervisor["@odata.id"] = "/redfish/v1/Systems/hypervisor";
@@ -2976,7 +2969,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << " Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_ERROR(" Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -3001,7 +2994,7 @@
if (eMsg.get_error() == nullptr)
{
- BMCWEB_LOG_ERROR << "D-Bus response error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus response error: {}", ec);
messages::internalError(res);
return;
}
@@ -3015,13 +3008,13 @@
(errorMessage ==
std::string_view("xyz.openbmc_project.State.Host.Error.BMCNotReady")))
{
- BMCWEB_LOG_DEBUG << "BMC not ready, operation not allowed right now";
+ BMCWEB_LOG_DEBUG("BMC not ready, operation not allowed right now");
messages::serviceTemporarilyUnavailable(res, "10");
return;
}
- BMCWEB_LOG_ERROR << "System Action Reset transition fail " << ec
- << " sdbusplus:" << errorMessage;
+ BMCWEB_LOG_ERROR("System Action Reset transition fail {} sdbusplus:{}", ec,
+ errorMessage);
messages::internalError(res);
}
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 050b75c..8a5c30b 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -265,7 +265,7 @@
}
else
{
- BMCWEB_LOG_INFO << "sendTaskEvent: No events to send";
+ BMCWEB_LOG_INFO("sendTaskEvent: No events to send");
}
}
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 9cc5ccb..42e66c9 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -48,7 +48,7 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/thermal_subsystem.hpp b/redfish-core/lib/thermal_subsystem.hpp
index 804b849..92e623e 100644
--- a/redfish-core/lib/thermal_subsystem.hpp
+++ b/redfish-core/lib/thermal_subsystem.hpp
@@ -22,7 +22,7 @@
{
if (!validChassisPath)
{
- BMCWEB_LOG_WARNING << "Not a valid chassis ID" << chassisId;
+ BMCWEB_LOG_WARNING("Not a valid chassis ID{}", chassisId);
messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
return;
}
diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp
index cd1b60f..48e348e 100644
--- a/redfish-core/lib/trigger.hpp
+++ b/redfish-core/lib/trigger.hpp
@@ -678,7 +678,7 @@
if (ec)
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
return;
}
@@ -687,8 +687,8 @@
if (!triggerId)
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "Unknown data returned by "
- "AddTrigger DBus method";
+ BMCWEB_LOG_ERROR("Unknown data returned by "
+ "AddTrigger DBus method");
return;
}
@@ -791,8 +791,8 @@
if (reportId.empty())
{
{
- BMCWEB_LOG_ERROR << "Property Reports contains invalid value: "
- << path.str;
+ BMCWEB_LOG_ERROR("Property Reports contains invalid value: {}",
+ path.str);
return std::nullopt;
}
}
@@ -848,8 +848,8 @@
getTriggerActions(*triggerActions);
if (!redfishTriggerActions)
{
- BMCWEB_LOG_ERROR
- << "Property TriggerActions is invalid in Trigger: " << id;
+ BMCWEB_LOG_ERROR(
+ "Property TriggerActions is invalid in Trigger: {}", id);
return false;
}
json["TriggerActions"] = *redfishTriggerActions;
@@ -861,8 +861,7 @@
getMetricReportDefinitions(*reports);
if (!linkedReports)
{
- BMCWEB_LOG_ERROR << "Property Reports is invalid in Trigger: "
- << id;
+ BMCWEB_LOG_ERROR("Property Reports is invalid in Trigger: {}", id);
return false;
}
json["Links"]["MetricReportDefinitions"] = *linkedReports;
@@ -877,10 +876,9 @@
if (!discreteTriggers)
{
- BMCWEB_LOG_ERROR
- << "Property Thresholds is invalid for discrete "
- "triggers in Trigger: "
- << id;
+ BMCWEB_LOG_ERROR("Property Thresholds is invalid for discrete "
+ "triggers in Trigger: {}",
+ id);
return false;
}
@@ -896,10 +894,9 @@
if (!numericThresholds)
{
- BMCWEB_LOG_ERROR
- << "Property Thresholds is invalid for numeric "
- "thresholds in Trigger: "
- << id;
+ BMCWEB_LOG_ERROR("Property Thresholds is invalid for numeric "
+ "thresholds in Trigger: {}",
+ id);
return false;
}
@@ -1012,7 +1009,7 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1046,7 +1043,7 @@
if (ec)
{
- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 357c047..3e75425 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -63,7 +63,7 @@
inline static void activateImage(const std::string& objPath,
const std::string& service)
{
- BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
+ BMCWEB_LOG_DEBUG("Activate image for {} {}", objPath, service);
sdbusplus::asio::setProperty(
*crow::connections::systemBus, service, objPath,
"xyz.openbmc_project.Software.Activation", "RequestedActivation",
@@ -71,8 +71,8 @@
[](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "error_code = " << ec;
- BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+ BMCWEB_LOG_DEBUG("error_code = {}", ec);
+ BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
}
});
}
@@ -89,10 +89,10 @@
m.read(objPath, interfacesProperties);
- BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+ BMCWEB_LOG_DEBUG("obj path = {}", objPath.str);
for (const auto& interface : interfacesProperties)
{
- BMCWEB_LOG_DEBUG << "interface = " << interface.first;
+ BMCWEB_LOG_DEBUG("interface = {}", interface.first);
if (interface.first == "xyz.openbmc_project.Software.Activation")
{
@@ -108,8 +108,8 @@
objInfo) mutable {
if (ec)
{
- BMCWEB_LOG_DEBUG << "error_code = " << ec;
- BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+ BMCWEB_LOG_DEBUG("error_code = {}", ec);
+ BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
if (asyncResp)
{
messages::internalError(asyncResp->res);
@@ -120,8 +120,7 @@
// Ensure we only got one service back
if (objInfo.size() != 1)
{
- BMCWEB_LOG_ERROR << "Invalid Object Size "
- << objInfo.size();
+ BMCWEB_LOG_ERROR("Invalid Object Size {}", objInfo.size());
if (asyncResp)
{
messages::internalError(asyncResp->res);
@@ -295,12 +294,11 @@
// expected, we were canceled before the timer completed.
return;
}
- BMCWEB_LOG_ERROR
- << "Timed out waiting for firmware object being created";
- BMCWEB_LOG_ERROR << "FW image may has already been uploaded to server";
+ BMCWEB_LOG_ERROR("Timed out waiting for firmware object being created");
+ BMCWEB_LOG_ERROR("FW image may has already been uploaded to server");
if (ec)
{
- BMCWEB_LOG_ERROR << "Async_wait failed" << ec;
+ BMCWEB_LOG_ERROR("Async_wait failed{}", ec);
return;
}
if (asyncResp)
@@ -310,7 +308,7 @@
});
task::Payload payload(req);
auto callback = [asyncResp, payload](sdbusplus::message_t& m) mutable {
- BMCWEB_LOG_DEBUG << "Match fired";
+ BMCWEB_LOG_DEBUG("Match fired");
softwareInterfaceAdded(asyncResp, m, std::move(payload));
};
@@ -332,7 +330,7 @@
interfacesProperties;
sdbusplus::message::object_path objPath;
m.read(objPath, interfacesProperties);
- BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+ BMCWEB_LOG_DEBUG("obj path = {}", objPath.str);
for (const std::pair<std::string, dbus::utility::DBusPropertiesMap>&
interface : interfacesProperties)
{
@@ -423,7 +421,7 @@
std::optional<std::string> transferProtocol;
std::string imageURI;
- BMCWEB_LOG_DEBUG << "Enter UpdateService.SimpleUpdate doPost";
+ BMCWEB_LOG_DEBUG("Enter UpdateService.SimpleUpdate doPost");
// User can pass in both TransferProtocol and ImageURI parameters or
// they can pass in just the ImageURI with the transfer protocol
@@ -434,8 +432,7 @@
if (!json_util::readJsonAction(req, asyncResp->res, "TransferProtocol",
transferProtocol, "ImageURI", imageURI))
{
- BMCWEB_LOG_DEBUG
- << "Missing TransferProtocol or ImageURI parameter";
+ BMCWEB_LOG_DEBUG("Missing TransferProtocol or ImageURI parameter");
return;
}
if (!transferProtocol)
@@ -449,22 +446,21 @@
messages::actionParameterValueTypeError(
asyncResp->res, imageURI, "ImageURI",
"UpdateService.SimpleUpdate");
- BMCWEB_LOG_ERROR << "ImageURI missing transfer protocol: "
- << imageURI;
+ BMCWEB_LOG_ERROR("ImageURI missing transfer protocol: {}",
+ imageURI);
return;
}
transferProtocol = imageURI.substr(0, separator);
// Ensure protocol is upper case for a common comparison path
// below
boost::to_upper(*transferProtocol);
- BMCWEB_LOG_DEBUG << "Encoded transfer protocol "
- << *transferProtocol;
+ BMCWEB_LOG_DEBUG("Encoded transfer protocol {}", *transferProtocol);
// Adjust imageURI to not have the protocol on it for parsing
// below
// ex. tftp://1.1.1.1/myfile.bin -> 1.1.1.1/myfile.bin
imageURI = imageURI.substr(separator + 3);
- BMCWEB_LOG_DEBUG << "Adjusted imageUri " << imageURI;
+ BMCWEB_LOG_DEBUG("Adjusted imageUri {}", imageURI);
}
// OpenBMC currently only supports TFTP
@@ -473,8 +469,8 @@
messages::actionParameterNotSupported(asyncResp->res,
"TransferProtocol",
"UpdateService.SimpleUpdate");
- BMCWEB_LOG_ERROR << "Request incorrect protocol parameter: "
- << *transferProtocol;
+ BMCWEB_LOG_ERROR("Request incorrect protocol parameter: {}",
+ *transferProtocol);
return;
}
@@ -486,13 +482,13 @@
messages::actionParameterValueTypeError(
asyncResp->res, imageURI, "ImageURI",
"UpdateService.SimpleUpdate");
- BMCWEB_LOG_ERROR << "Invalid ImageURI: " << imageURI;
+ BMCWEB_LOG_ERROR("Invalid ImageURI: {}", imageURI);
return;
}
std::string tftpServer = imageURI.substr(0, separator);
std::string fwFile = imageURI.substr(separator + 1);
- BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile;
+ BMCWEB_LOG_DEBUG("Server: {}{}", tftpServer + " File: ", fwFile);
// Setup callback for when new software detected
// Give TFTP 10 minutes to complete
@@ -514,19 +510,19 @@
{
// messages::internalError(asyncResp->res);
cleanUp();
- BMCWEB_LOG_DEBUG << "error_code = " << ec;
- BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+ BMCWEB_LOG_DEBUG("error_code = {}", ec);
+ BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
}
else
{
- BMCWEB_LOG_DEBUG << "Call to DownloaViaTFTP Success";
+ BMCWEB_LOG_DEBUG("Call to DownloaViaTFTP Success");
}
},
"xyz.openbmc_project.Software.Download",
"/xyz/openbmc_project/software", "xyz.openbmc_project.Common.TFTP",
"DownloadViaTFTP", fwFile, tftpServer);
- BMCWEB_LOG_DEBUG << "Exit UpdateService.SimpleUpdate doPost";
+ BMCWEB_LOG_DEBUG("Exit UpdateService.SimpleUpdate doPost");
});
}
@@ -534,7 +530,7 @@
{
std::filesystem::path filepath("/tmp/images/" + bmcweb::getRandomUUID());
- BMCWEB_LOG_DEBUG << "Writing file to " << filepath;
+ BMCWEB_LOG_DEBUG("Writing file to {}", filepath.string());
std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary |
std::ofstream::trunc);
// set the permission of the file to 640
@@ -566,8 +562,8 @@
}
else
{
- BMCWEB_LOG_INFO
- << "ApplyTime value is not in the list of acceptable values";
+ BMCWEB_LOG_INFO(
+ "ApplyTime value is not in the list of acceptable values");
messages::propertyValueNotInList(asyncResp->res, applyTime,
"ApplyTime");
return;
@@ -581,7 +577,7 @@
applyTimeNewVal, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -602,10 +598,10 @@
formpart.fields.find("Content-Disposition");
if (it == formpart.fields.end())
{
- BMCWEB_LOG_ERROR << "Couldn't find Content-Disposition";
+ BMCWEB_LOG_ERROR("Couldn't find Content-Disposition");
return;
}
- BMCWEB_LOG_INFO << "Parsing value " << it->value();
+ BMCWEB_LOG_INFO("Parsing value {}", it->value());
// The construction parameters of param_list must start with `;`
size_t index = it->value().find(';');
@@ -656,7 +652,7 @@
if (uploadData == nullptr)
{
- BMCWEB_LOG_ERROR << "Upload data is NULL";
+ BMCWEB_LOG_ERROR("Upload data is NULL");
messages::propertyMissing(asyncResp->res, "UpdateFile");
return;
}
@@ -681,7 +677,7 @@
}
std::string_view contentType = req.getHeaderValue("Content-Type");
- BMCWEB_LOG_DEBUG << "doPost: contentType=" << contentType;
+ BMCWEB_LOG_DEBUG("doPost: contentType={}", contentType);
// Make sure that content type is application/octet-stream or
// multipart/form-data
@@ -705,8 +701,8 @@
if (ec != ParserError::PARSER_SUCCESS)
{
// handle error
- BMCWEB_LOG_ERROR << "MIME parse failed, ec : "
- << static_cast<int>(ec);
+ BMCWEB_LOG_ERROR("MIME parse failed, ec : {}",
+ static_cast<int>(ec));
messages::internalError(asyncResp->res);
return;
}
@@ -714,7 +710,7 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Bad content type specified:" << contentType;
+ BMCWEB_LOG_DEBUG("Bad content type specified:{}", contentType);
asyncResp->res.result(boost::beast::http::status::bad_request);
}
}
@@ -768,7 +764,7 @@
const std::string& applyTime) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -799,7 +795,7 @@
{
return;
}
- BMCWEB_LOG_DEBUG << "doPatch...";
+ BMCWEB_LOG_DEBUG("doPatch...");
std::optional<nlohmann::json> pushUriOptions;
if (!json_util::readJsonPatch(req, asyncResp->res, "HttpPushUriOptions",
@@ -890,7 +886,7 @@
}
else
{
- BMCWEB_LOG_ERROR << "Unknown software purpose " << purpose;
+ BMCWEB_LOG_ERROR("Unknown software purpose {}", purpose);
}
}
@@ -926,16 +922,16 @@
if (swInvPurpose == nullptr)
{
- BMCWEB_LOG_DEBUG << "Can't find property \"Purpose\"!";
+ BMCWEB_LOG_DEBUG("Can't find property \"Purpose\"!");
messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_DEBUG << "swInvPurpose = " << *swInvPurpose;
+ BMCWEB_LOG_DEBUG("swInvPurpose = {}", *swInvPurpose);
if (version == nullptr)
{
- BMCWEB_LOG_DEBUG << "Can't find property \"Version\"!";
+ BMCWEB_LOG_DEBUG("Can't find property \"Version\"!");
messages::internalError(asyncResp->res);
@@ -991,7 +987,7 @@
[asyncResp,
swId](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
- BMCWEB_LOG_DEBUG << "doGet callback...";
+ BMCWEB_LOG_DEBUG("doGet callback...");
if (ec)
{
messages::internalError(asyncResp->res);
@@ -1022,7 +1018,7 @@
}
if (!found)
{
- BMCWEB_LOG_WARNING << "Input swID " << *swId << " not found!";
+ BMCWEB_LOG_WARNING("Input swID {} not found!", *swId);
messages::resourceMissingAtURI(
asyncResp->res,
boost::urls::format(
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 81af41f..e425cc1 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -46,8 +46,7 @@
const std::string& resName)
{
std::string thisPath = itemPath.filename();
- BMCWEB_LOG_DEBUG << "Filename: " << itemPath.str
- << ", ThisPath: " << thisPath;
+ BMCWEB_LOG_DEBUG("Filename: {}, ThisPath: {}", itemPath.str, thisPath);
if (thisPath.empty())
{
@@ -102,7 +101,7 @@
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
return;
}
@@ -117,7 +116,7 @@
}
}
- BMCWEB_LOG_DEBUG << "Parent item not found";
+ BMCWEB_LOG_DEBUG("Parent item not found");
asyncResp->res.result(boost::beast::http::status::not_found);
});
}
@@ -224,7 +223,7 @@
const bool* activeValue = std::get_if<bool>(&value);
if (activeValue == nullptr)
{
- BMCWEB_LOG_DEBUG << "Value Active not found";
+ BMCWEB_LOG_DEBUG("Value Active not found");
return;
}
asyncResp->res.jsonValue["Inserted"] = *activeValue;
@@ -272,7 +271,7 @@
const std::string& service,
const std::string& name)
{
- BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
+ BMCWEB_LOG_DEBUG("Get available Virtual Media resources.");
sdbusplus::message::object_path objPath(
"/xyz/openbmc_project/VirtualMedia");
dbus::utility::getManagedObjects(
@@ -282,7 +281,7 @@
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error";
+ BMCWEB_LOG_DEBUG("DBUS response error");
return;
}
nlohmann::json& members = asyncResp->res.jsonValue["Members"];
@@ -344,7 +343,7 @@
const std::string& service, const std::string& name,
const std::string& resName)
{
- BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
+ BMCWEB_LOG_DEBUG("Get Virtual Media resource data.");
findAndParseObject(service, resName, asyncResp,
std::bind_front(afterGetVmData, name));
@@ -601,7 +600,7 @@
if (credentials.user().size() + credentials.password().size() + 2 >
secretLimit)
{
- BMCWEB_LOG_ERROR << "Credentials too long to handle";
+ BMCWEB_LOG_ERROR("Credentials too long to handle");
messages::unrecognizedRequestBody(asyncResp->res);
return;
}
@@ -625,7 +624,7 @@
[asyncResp](const boost::system::error_code& ec, std::size_t) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Failed to pass secret: " << ec;
+ BMCWEB_LOG_ERROR("Failed to pass secret: {}", ec);
messages::internalError(asyncResp->res);
}
});
@@ -636,12 +635,12 @@
bool success) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
}
else if (!success)
{
- BMCWEB_LOG_ERROR << "Service responded with error";
+ BMCWEB_LOG_ERROR("Service responded with error");
messages::generalError(asyncResp->res);
}
},
@@ -659,11 +658,11 @@
const std::string& resName,
InsertMediaActionParams& actionParams)
{
- BMCWEB_LOG_DEBUG << "Validation started";
+ BMCWEB_LOG_DEBUG("Validation started");
// required param imageUrl must not be empty
if (!actionParams.imageUrl)
{
- BMCWEB_LOG_ERROR << "Request action parameter Image is empty.";
+ BMCWEB_LOG_ERROR("Request action parameter Image is empty.");
messages::propertyValueFormatError(asyncResp->res, "<empty>", "Image");
@@ -673,8 +672,8 @@
// optional param inserted must be true
if ((actionParams.inserted != std::nullopt) && !*actionParams.inserted)
{
- BMCWEB_LOG_ERROR
- << "Request action optional parameter Inserted must be true.";
+ BMCWEB_LOG_ERROR(
+ "Request action optional parameter Inserted must be true.");
messages::actionParameterNotSupported(asyncResp->res, "Inserted",
"InsertMedia");
@@ -686,8 +685,8 @@
if ((actionParams.transferMethod != std::nullopt) &&
(*actionParams.transferMethod != "Stream"))
{
- BMCWEB_LOG_ERROR << "Request action optional parameter "
- "TransferMethod must be Stream.";
+ BMCWEB_LOG_ERROR("Request action optional parameter "
+ "TransferMethod must be Stream.");
messages::actionParameterNotSupported(asyncResp->res, "TransferMethod",
"InsertMedia");
@@ -711,9 +710,9 @@
// ImageUrl does not contain valid protocol type
if (*uriTransferProtocolType == TransferProtocol::invalid)
{
- BMCWEB_LOG_ERROR << "Request action parameter ImageUrl must "
- "contain specified protocol type from list: "
- "(smb, https).";
+ BMCWEB_LOG_ERROR("Request action parameter ImageUrl must "
+ "contain specified protocol type from list: "
+ "(smb, https).");
messages::resourceAtUriInUnknownFormat(asyncResp->res, *url);
@@ -723,9 +722,9 @@
// transferProtocolType should contain value from list
if (*paramTransferProtocolType == TransferProtocol::invalid)
{
- BMCWEB_LOG_ERROR << "Request action parameter TransferProtocolType "
- "must be provided with value from list: "
- "(CIFS, HTTPS).";
+ BMCWEB_LOG_ERROR("Request action parameter TransferProtocolType "
+ "must be provided with value from list: "
+ "(CIFS, HTTPS).");
messages::propertyValueNotInList(asyncResp->res,
*actionParams.transferProtocolType,
@@ -737,9 +736,9 @@
if ((uriTransferProtocolType == std::nullopt) &&
(paramTransferProtocolType == std::nullopt))
{
- BMCWEB_LOG_ERROR << "Request action parameter ImageUrl must "
- "contain specified protocol type or param "
- "TransferProtocolType must be provided.";
+ BMCWEB_LOG_ERROR("Request action parameter ImageUrl must "
+ "contain specified protocol type or param "
+ "TransferProtocolType must be provided.");
messages::resourceAtUriInUnknownFormat(asyncResp->res, *url);
@@ -753,10 +752,10 @@
// check if protocol is the same for URI and param
if (*paramTransferProtocolType != *uriTransferProtocolType)
{
- BMCWEB_LOG_ERROR << "Request action parameter "
- "TransferProtocolType must contain the "
- "same protocol type as protocol type "
- "provided with param imageUrl.";
+ BMCWEB_LOG_ERROR("Request action parameter "
+ "TransferProtocolType must contain the "
+ "same protocol type as protocol type "
+ "provided with param imageUrl.");
messages::actionParameterValueTypeError(
asyncResp->res, *actionParams.transferProtocolType,
@@ -805,7 +804,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
@@ -820,7 +819,7 @@
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+ BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
messages::internalError(asyncResp->res);
return;
@@ -869,14 +868,14 @@
const dbus::utility::MapperGetObject& getObjectType) mutable {
if (ec)
{
- BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+ BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
messages::resourceNotFound(asyncResp->res, action, resName);
return;
}
std::string service = getObjectType.begin()->first;
- BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+ BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
sdbusplus::message::object_path path(
"/xyz/openbmc_project/VirtualMedia");
@@ -888,8 +887,8 @@
if (ec2)
{
// Not possible in proxy mode
- BMCWEB_LOG_DEBUG << "InsertMedia not "
- "allowed in proxy mode";
+ BMCWEB_LOG_DEBUG("InsertMedia not "
+ "allowed in proxy mode");
messages::resourceNotFound(asyncResp->res, action, resName);
return;
@@ -904,7 +903,7 @@
return;
}
}
- BMCWEB_LOG_DEBUG << "Parent item not found";
+ BMCWEB_LOG_DEBUG("Parent item not found");
messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName);
});
});
@@ -935,13 +934,13 @@
const dbus::utility::MapperGetObject& getObjectType) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec2;
+ BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec2);
messages::internalError(asyncResp->res);
return;
}
std::string service = getObjectType.begin()->first;
- BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+ BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
sdbusplus::message::object_path path(
"/xyz/openbmc_project/VirtualMedia");
@@ -952,7 +951,7 @@
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
- BMCWEB_LOG_ERROR << "ObjectMapper : No Service found";
+ BMCWEB_LOG_ERROR("ObjectMapper : No Service found");
messages::resourceNotFound(asyncResp->res, action, resName);
return;
}
@@ -967,7 +966,7 @@
return;
}
}
- BMCWEB_LOG_DEBUG << "Parent item not found";
+ BMCWEB_LOG_DEBUG("Parent item not found");
messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName);
});
});
@@ -1001,13 +1000,13 @@
const dbus::utility::MapperGetObject& getObjectType) {
if (ec)
{
- BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+ BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
messages::internalError(asyncResp->res);
return;
}
std::string service = getObjectType.begin()->first;
- BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+ BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
getVmResourceList(asyncResp, service, name);
});
@@ -1036,13 +1035,13 @@
const dbus::utility::MapperGetObject& getObjectType) {
if (ec)
{
- BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+ BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
messages::internalError(asyncResp->res);
return;
}
std::string service = getObjectType.begin()->first;
- BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+ BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
getVmData(asyncResp, service, name, resName);
});
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 85aab34..38f10c8 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -51,16 +51,15 @@
auto messageIdIterator = message.find("MessageId");
if (messageIdIterator == message.end())
{
- BMCWEB_LOG_CRITICAL
- << "Attempt to add error message without MessageId";
+ BMCWEB_LOG_CRITICAL(
+ "Attempt to add error message without MessageId");
return;
}
auto messageFieldIterator = message.find("Message");
if (messageFieldIterator == message.end())
{
- BMCWEB_LOG_CRITICAL
- << "Attempt to add error message without Message";
+ BMCWEB_LOG_CRITICAL("Attempt to add error message without Message");
return;
}
error["code"] = *messageIdIterator;
@@ -282,9 +281,9 @@
void internalError(crow::Response& res, const std::source_location location)
{
- BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "("
- << location.line() << ":" << location.column() << ") `"
- << location.function_name() << "`: ";
+ BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
+ location.line(), location.column(),
+ location.function_name());
res.result(boost::beast::http::status::internal_server_error);
addMessageToErrorJson(res.jsonValue, internalError());
}