Use string object for log output buffering.

Clang doesn't want to pass a char array to boost::format and I can't be
arsed finding out why.
This commit is contained in:
Danny Robson 2012-06-13 15:49:22 +10:00
parent f5fa3219b4
commit d968bd8549

View File

@ -115,10 +115,12 @@ util::detail::log (level_t level, boost::format &&format) {
static const boost::format LEVEL_FORMAT ("%s [%s] "); static const boost::format LEVEL_FORMAT ("%s [%s] ");
char time_string[strlen("YYYY-mm-dd HHMMhSS") + 1]; static const size_t time_len = strlen("YYYY-mm-dd HHMMhSS") + 1;
std::string time_string (time_len, '\0');
time_t unix_time = time (nullptr); time_t unix_time = time (nullptr);
if (0 == strftime (time_string,
elems (time_string), if (0 == strftime (&time_string[0],
time_len,
"%Y-%m-%d %H%Mh%S", "%Y-%m-%d %H%Mh%S",
localtime (&unix_time))) { localtime (&unix_time))) {
unusual (); unusual ();