Corrected formatting of logged messages.

--HG--
extra : source : 055166b931edaf78d482a143b5c8b6898a387904
This commit is contained in:
2013-12-14 18:13:00 -08:00
parent b704ae5523
commit f97c51ce44

View File

@@ -119,12 +119,12 @@ void KRContext::Log(log_level level, const std::string &message_format, ...)
if(s_log_callback) { if(s_log_callback) {
const int LOG_BUFFER_SIZE = 32768; const int LOG_BUFFER_SIZE = 32768;
char log_buffer[LOG_BUFFER_SIZE]; char log_buffer[LOG_BUFFER_SIZE];
snprintf(log_buffer, LOG_BUFFER_SIZE, message_format.c_str(), args); vsnprintf(log_buffer, LOG_BUFFER_SIZE, message_format.c_str(), args);
s_log_callback(s_log_callback_user_data, std::string(log_buffer), level); s_log_callback(s_log_callback_user_data, std::string(log_buffer), level);
} else { } else {
FILE *out_file = level == LOG_LEVEL_INFORMATION ? stdout : stderr; FILE *out_file = level == LOG_LEVEL_INFORMATION ? stdout : stderr;
fprintf(out_file, "Kraken - INFO: "); fprintf(out_file, "Kraken - INFO: ");
fprintf(out_file, message_format.c_str(), args); vfprintf(out_file, message_format.c_str(), args);
fprintf(out_file, "\n"); fprintf(out_file, "\n");
} }