Switch to vector

v1
Brett 2023-02-08 13:16:31 -05:00
parent 54fdeb1ad5
commit e07b631856
1 changed files with 3 additions and 4 deletions

View File

@ -61,10 +61,9 @@ namespace blt::logging {
}; };
void applyFormatting(const std::string& format, std::string& output, va_list& args){ void applyFormatting(const std::string& format, std::string& output, va_list& args){
const char* fmt_c_str = format.c_str(); std::vector<char> buf(1+std::vsnprintf(nullptr, 0, format.c_str(), args));
char formattedChars[1+std::vsnprintf(nullptr, 0, fmt_c_str, args)]; vsprintf(buf.data(), format.c_str(), args);
vsprintf(formattedChars, fmt_c_str, args); output = std::string(buf.data());
output = std::string(formattedChars);
} }
const char* levelColors[6] = { const char* levelColors[6] = {