Merge pull request #1685 from eddelbuettel/feature/r_use_of_reprintf

let R header defines switch to REprintf over fprintf(stdderr)
This commit is contained in:
Gabi Melman 2020-09-29 02:18:35 +03:00 committed by GitHub
commit 21cf8d7d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,7 +247,11 @@ SPDLOG_INLINE void logger::err_handler_(const std::string &msg)
auto tm_time = details::os::localtime(system_clock::to_time_t(now)); auto tm_time = details::os::localtime(system_clock::to_time_t(now));
char date_buf[64]; char date_buf[64];
std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time);
fprintf(stderr, "[*** LOG ERROR #%04zu ***] [%s] [%s] {%s}\n", err_counter, date_buf, name().c_str(), msg.c_str()); #if !defined(R_R_H) || !defined(USING_R)
std::fprintf(stderr, "[*** LOG ERROR #%04zu ***] [%s] [%s] {%s}\n", err_counter, date_buf, name().c_str(), msg.c_str());
#else
REprintf("[*** LOG ERROR #%04zu ***] [%s] [%s] {%s}\n", err_counter, date_buf, name().c_str(), msg.c_str());
#endif
} }
} }
} // namespace spdlog } // namespace spdlog