Don't rely on operator << for object logging
In the upcoming fmt patch, we remove the use of streams, and a number of
our logging statements are relying on them. This commit changes them to
no longer rely on operator>> or operator+ to build their strings. This
alone isn't very useful, but in the context of the next patch makes the
automation able to do a complete conversion of all log statements
automatically.
Tested: enabled logging on local and saw log statements print to console
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I0e5dc2cf015c6924037e38d547535eda8175a6a1
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 889f606..6d17a61 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -164,20 +164,22 @@
std::ofstream::trunc);
out << certString;
out.close();
- BMCWEB_LOG_DEBUG << "Creating certificate file" << certificateFile;
+ BMCWEB_LOG_DEBUG << "Creating certificate file"
+ << certificateFile.string();
}
}
~CertificateFile()
{
if (std::filesystem::exists(certDirectory))
{
- BMCWEB_LOG_DEBUG << "Removing certificate file" << certificateFile;
+ 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;
+ << certDirectory.string();
}
}
}
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index acaa40a..b0e2507 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1872,8 +1872,8 @@
return;
}
- BMCWEB_LOG_DEBUG
- << "Setting firmware version " + firmwareId + " to priority 0.";
+ BMCWEB_LOG_DEBUG << "Setting firmware version " << firmwareId
+ << " to priority 0.";
// Only support Immediate
// An addition could be a Redfish Setting like
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 6c61e40..841463a 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -927,8 +927,8 @@
}
if (!found)
{
- BMCWEB_LOG_ERROR
- << "Input swID " + *swId + " not found!";
+ BMCWEB_LOG_ERROR << "Input swID " << *swId
+ << " not found!";
messages::resourceMissingAtURI(
asyncResp->res,
crow::utility::urlFromPieces(