In my application I have a lot of logs. I do accumulate all errors from all logs in one place called errorsLogger
. I've implemented it this way:
static Logger errorsLogger;
....
void Logger::Error(std::string format, ...) {
va_list arglist;
va_start(arglist, format);
if (this != &errorsLogger) {
errorsLogger.Error(format, arglist); // how to forward parameters?
}
vfprintf(logFile, , format.c_str(), arglist);
fprintf(logFile, "\n");
fflush(logFile);
va_end( arglist );
}
However this code doesn't work as expected errorsLogger
contains a little bit strange strings - it seems variable arguments was not passed. How to fix my code to be valid?