If C++11 is an option for you (and considering the inclusion of the <thread>
header, this seems to be the case), you could use variadic templates instead of C-style variadic functions.
Something like this should do the job (can't test it right now, so please tell me if it doesn't work and I'll try to fix it):
template<typename T>
void insert_messages(std::stringstream& ss, T&& arg)
{
ss << std::forward<T>(arg);
}
template<typename T, typename... Ts>
void insert_messages(std::stringstream& ss, T&& arg, Ts&&... args)
{
ss << std::forward<T>(arg);
logMessage(std::forward<Ts>(args)...);
}
template<typename... Ts>
void logHelperMessage(loglevel severity, Ts&&... args)
{
std::stringstream ss;
insert_messages(ss, std::forward<Ts>(args)...);
std::string s = ss.str();
std::thread t1(threadedloghelpermessage,severity,s);
t1.join();
}