pivotal-jbarrett commented on a change in pull request #797:
URL: https://github.com/apache/geode-native/pull/797#discussion_r625859597
##########
File path: cppcache/integration-test/fw_dunit.cpp
##########
@@ -688,36 +680,63 @@ void sleep(int millis) {
}
void logCoordinator(std::string s, int lineno, const char * /*filename*/) {
- char buf[128] = {0};
- dunit::getTimeStr(buf, sizeof(buf));
-
- fprintf(stdout, "[TEST coordinator:pid(%d)] %s at line: %d\n",
- boost::this_process::get_id(), s.c_str(), lineno);
- fflush(stdout);
+ using std::chrono::duration_cast;
+ using std::chrono::microseconds;
+ using std::chrono::system_clock;
+
+ auto now = system_clock::now();
+ auto in_time_t = system_clock::to_time_t(now);
+ auto localtime = std::localtime(&in_time_t);
+ auto usec =
+ duration_cast<microseconds>(now.time_since_epoch()).count() % 1000;
+
+ std::cout << "[TEST " << std::put_time(localtime, "%Y/%m/%d %H:%M:%S") << '.'
+ << std::setfill('0') << std::setw(6) << usec << std::setw(0)
+ << " coordinator:pid(" << boost::this_process::get_id() << ")] "
+ << s << " at line: " << lineno << std::endl
+ << std::flush;
}
// log a message and print the worker id as well.. used by fw_helper with no
// worker id.
void log(std::string s, int lineno, const char * /*filename*/, int /*id*/) {
- char buf[128] = {0};
- dunit::getTimeStr(buf, sizeof(buf));
-
- fprintf(stdout, "[TEST 0:pid(%d)] %s at line: %d\n",
- boost::this_process::get_id(), s.c_str(), lineno);
- fflush(stdout);
+ using std::chrono::duration_cast;
Review comment:
With the transition to boost::log for the test framework, what is still
using this logger?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]