Hello guys,
I am using SDL in my game, which has a nice logging function called SDL_Log().
I would like to use this, but prefer to use a different name for the function (e.g. GameLog()). The reason is that if I ever want to add functionality to this logging function, I can just do it in one place. Also, if I ever switch from SDL to Allegro or another 2D multimedia library, I don't have to change this everywhere in my code.
The problem is, I have no clue how to do this. The function is defined as:
void SDL_Log(const char* fmt, ...)
How would I be able to do this?
What I have tried:
I tried using #defines (but even though I cant get it to work, I prefer to use no proprocessor code for this).
I tried using typedef, using va_list, va_start, va_arg etc.
The code below didn't do the trick.
void GameLog(const char* log, ...)
{
va_list args;
va_start(args, log);
SDL_Log(log, args);
va_end(args);
}
Is there anyone that has a clue how to do this?
I thought it would be simple to do at first, but I've been struggling with this for many days now.