Hi! I am trying to implement a logger class that behaves like printf: this is the only requirement, to implement a member function that accepts a format and a variable number of arguments, just like printf.
However, the static member Logger::log is implemented using old-style C streams:
Code:
void Logger::log(char *format, ...)
{
#ifdef DEBUG
va_list args;
char *p;
// Check for null argument list
va_start(args, format);
p = va_arg(args, char*);
va_end(args);
//
va_start(args, format);
if (p == NULL)
{
fprintf(logger, "%s", format);
}
else
{
fvprintf(logger, format, args);
}
va_end(args);
#endif
}
My question is simple. Is there a way of moving away the FILE* logger, replacing it with some C++ iostream-reletated class?
Sorry for this (probably) simple question!
Thanks and Cheers!