Fix va_list problem
This commit is contained in:
parent
a9d47591ef
commit
4bb708822a
|
@ -49,6 +49,8 @@ void destroy_logger() {
|
|||
void logprint(LogLevel level, char* str, va_list args)
|
||||
{
|
||||
clock_t t = clock();
|
||||
va_list args2;
|
||||
va_copy(args2, args);
|
||||
|
||||
char label[6];
|
||||
char ansi_code[12];
|
||||
|
@ -90,14 +92,14 @@ void logprint(LogLevel level, char* str, va_list args)
|
|||
if (level < logger->level)
|
||||
return;
|
||||
|
||||
fprintf(stream, "%s[%s][%f]: ", ansi_code, label, (double)t / CLOCKS_PER_SEC);
|
||||
fprintf(stream, "%s[%s][%f]: \033[0m", ansi_code, label, (double)t / CLOCKS_PER_SEC);
|
||||
vfprintf(stream, str, args);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
if (logger->logfile != NULL)
|
||||
{
|
||||
fprintf(logger->logfile, "[%s][%f]: ", label, (double)t / CLOCKS_PER_SEC);
|
||||
vfprintf(logger->logfile, str, args);
|
||||
vfprintf(logger->logfile, str, args2);
|
||||
fprintf(logger->logfile, "\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue