Switch to std::cerr for prints
std::cout is buffered, so the prints don't always show up with
the correct timestamp. The better change is probably to move
to phosphor::logging, but for now just change to std::cerr to
get the prints immediately.
Tested:
Confirmed that the print messages show up immediately with the
correct timestamps.
Change-Id: I208eb042e00275889dda3dd088095e4c57db880d
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
diff --git a/src/host_error_monitor.cpp b/src/host_error_monitor.cpp
index c637188..5ef907d 100644
--- a/src/host_error_monitor.cpp
+++ b/src/host_error_monitor.cpp
@@ -420,7 +420,7 @@
static void startCrashdumpAndRecovery(bool recoverSystem,
const std::string& triggerType)
{
- std::cout << "Starting crashdump\n";
+ std::cerr << "Starting crashdump\n";
static std::shared_ptr<sdbusplus::bus::match::match> crashdumpCompleteMatch;
static boost::asio::steady_timer crashdumpTimer(io);
@@ -430,10 +430,10 @@
"member='PropertiesChanged',arg0namespace='com.intel.crashdump'",
[recoverSystem](sdbusplus::message::message& msg) {
crashdumpTimer.cancel();
- std::cout << "Crashdump completed\n";
+ std::cerr << "Crashdump completed\n";
if (recoverSystem)
{
- std::cout << "Recovering the system\n";
+ std::cerr << "Recovering the system\n";
startWarmReset();
}
crashdumpCompleteMatch.reset();
@@ -449,7 +449,7 @@
std::cerr << "Crashdump async_wait failed: " << ec.message()
<< "\n";
}
- std::cout << "Crashdump timer canceled\n";
+ std::cerr << "Crashdump timer canceled\n";
return;
}
std::cerr << "Crashdump failed to complete before timeout\n";
@@ -1401,7 +1401,7 @@
#else
if (*reset)
{
- std::cout << "Recovering the system\n";
+ std::cerr << "Recovering the system\n";
startWarmReset();
}
#endif