[ https://issues.apache.org/jira/browse/GEODE-9214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17337685#comment-17337685 ]
ASF GitHub Bot commented on GEODE-9214: --------------------------------------- pivotal-jbarrett commented on a change in pull request #797: URL: https://github.com/apache/geode-native/pull/797#discussion_r624283170 ########## File path: tests/cpp/fwklib/FwkLog.cpp ########## @@ -54,32 +55,24 @@ const char* dirAndFile(const char* str) { } void plog(const char* l, const char* s, const char* filename, int32_t lineno) { Review comment: If it simlifies things, the only callers to this method are macros that are converting a `std::ostringstream` to a `char *` so you could just pass a `std::ostringstream &` or `const std::string &` here. ```c++ void plog(const std::string& level, const std::string& message, const std::string& filename, size_t lineNumber); ``` ########## File path: tests/cpp/fwklib/FwkLog.cpp ########## @@ -54,32 +55,24 @@ const char* dirAndFile(const char* str) { } void plog(const char* l, const char* s, const char* filename, int32_t lineno) { - // ACE_TCHAR tstamp[64]; - // ACE::timestamp( tstamp, 64, 1 ); - // tstamp is like "Tue May 17 2005 12:54:22.546780" - // for our purpose we just want "12:54:22.546780" - char buf[256] = {0}; - const size_t MINBUFSIZE = 128; - ACE_Time_Value clock = ACE_OS::gettimeofday(); - time_t secs = clock.sec(); - struct tm* tm_val = ACE_OS::localtime(&secs); - char* pbuf = buf; - pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val); - pbuf += ACE_OS::snprintf(pbuf, 15, ".%06" PRId64 " ", - static_cast<int64_t>(clock.usec())); - ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val); - static bool needInit = true; - if (needInit) { - ACE_OS::uname(&u); - needInit = false; - } + using std::chrono::duration_cast; + using std::chrono::microseconds; + using std::chrono::system_clock; - const char* fil = dirAndFile(filename); + 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; - fprintf(stdout, "[%s %s %s:P%d:T%" PRIu64 "]::%s::%d %s %s\n", buf, - u.sysname, u.nodename, ACE_OS::getpid(), - hacks::aceThreadId(ACE_OS::thr_self()), fil, lineno, l, s); - fflush(stdout); + const char* fil = dirAndFile(filename); + std::cout << '[' << std::put_time(localtime, "%Y/%m/%d %H:%M:%S") << '.' + << std::setfill('0') << std::setw(6) << usec << std::setw(0) + << std::put_time(localtime, " %Z ") << boost::asio::ip::host_name() Review comment: If it simplifies anything to drop the hostname, change the formatting, and/or switch to boost::log like the new test framework I don't think it will matter any. The old framework used to support running the child processes remotely, so logging the hostnames was useful in debugging. It can't run remotely anymore so hostname Is not so useful. I don't think anyone is tied to the log format either. -- 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: us...@infra.apache.org > Remove ACE time library references > ---------------------------------- > > Key: GEODE-9214 > URL: https://issues.apache.org/jira/browse/GEODE-9214 > Project: Geode > Issue Type: Improvement > Components: native client > Reporter: Mario Salazar de Torres > Assignee: Mario Salazar de Torres > Priority: Major > Labels: obliterate-ace, pull-request-available > > *AS A* geode-native contributor > *I WANT TO* remove all references to ACE time library > *SO THAT* we can advance in the effort to completly remove ACE library from > the native client -- This message was sent by Atlassian Jira (v8.3.4#803005)