I'm looking at a vendor provided logMsg function
char * fmt, /* format string for print */
int arg1, /* first of six required args for fmt */
With the description:
This routine logs a specified message via the logging task. This routine's syntax is similar to printf( ) -- a format string is followed by arguments to format. However, the logMsg( ) routine requires a fixed number of arguments (6).
The first drawback is it requires 6 arguments after the format string -- even if the arguments aren't used. This makes the function slightly annoying to use. To make it appear more printf-like, I suspect I could define seven macros which will take the form: logMsgN(fmt, arg1, arg2, ..., argn) where N indicates how many of the six trailing arguments there are.
Secondly, I'd like to wrap this logMsg function in a class. An instance of that class will get created and I could do things like:
log << MSG::ERROR << "Unable to create address for /dd" << '\n';
log << MSG::DEBUG << "Finalizing" << '\n';
log << MSG::WARNING
I suspect with the wrapper class I may not need the macros. The number of arguments could be inferred via "<<". In any event, I'm open to ideas .. I'll increase points provide a solution exists with source code results (i.e show me source..if source doesn't warrant 60 points I'll increase accordingly)