,
Log(const char *format, ...)
{
char buffer[MAX_BUFFER_SIZE];
va_list args;
va_start(args, format);
vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
printf("%s", buffer);
}
Log("a[%d][%d] =\t%d\n", x, y, a[x][y])
Log("if(%s) func(%d) ;", (condition) ? "true" : "False", func(foo))
add in some loggingtype (i.e. LOG_SCREEN, LOG_FILE) to the function Log() and now you can control where is gets logged to
add in some logginglevel (i.e. WARN, CRIT) to control how it gets displayed, color etc.
Of course there are many, many library out there that do all this type of stuff already
hope this helps