Exception boost::format
Использую boost::format по примерам с официальной документации, но получаю terminating with uncaught exception of type boost::wrapexceptboost::io::bad_format_string: boost::bad_format_string: format-string is ill-formed
Интересует причина такого поведения.
Декларация:
std::string Logger::_format("[%TimeStamp%] [%ThreadID%] [%Severity%] %Message% \n");
std::array<std::string, 6> enumArray = {"trace",
"debug",
"info",
"warning",
"error",
"fatal"};
std::string msg("...");
Использование:
static std::string getDate() {
std::stringstream buff;
time_t now = time(nullptr);
tm *ltm = localtime(&now);
buff << 1970 + ltm->tm_year << '-' << ltm->tm_mon << '-' << ltm->tm_mday;
buff << ' ' << 1 + ltm->tm_hour << ':' << 1 + ltm->tm_min << ':' << 1 + ltm->tm_sec;
return buff.str();
}
std::cerr << boost::format(_format) % getDate() % "s" % enumArray[log] % msg;