KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
We have a huge set of functions exposed as an external API and we need to trace all argument values in each call. Currently we have a macro that accepts the list of all parameters: void SomeApiFunction( bool parameter1, const wchar_t* parameter2 ) { LOG_PARAMETERS( parameter1 << parameter2 ) //function payload } The macro expands as follows: #define LOG_PARAMETERS( x ) GlobalLoggerObject << x; and GlobalLoggerObject is of type class CLogger that has operator << overloaded for all possible parameter types - something like this: template<class TypeToLog> CLogger& operator << (const TypeToLog& parameter) { //logging code return *this; } so that we can have a parameters list of any length and thanks to a chain of << they can be all passed into the macro and necessary concrete versions of operator << are instantiated depending on the type of the parameter. Great except we have to maintain the list of parameters fully synchronous to that of the surrounding function. Is there some way to just grab all the parameters at once - something like this: TRACE_ALL_PARAMETERS( UNIVERSAL_MAGIC ) so that we don't have to list each parameter explicitly?
Tags (comma-separated)
Save Edits
Cancel