
Avi Bahra wrote:
Is there anything in boost/design pattern that can help with following:
std::stringstream ss; ss << "SUBMIT: Task(" << absPath << ") "; log( Log::DBG, ss );
The code I am working on does this all over the place, what I would like is :
log( Log::DBG, "SUBMIT: Task(" << absPath << ") " );
Something simple would be to use lexical_cast (assuming your log()
function has an overload accepting strings):
log(Log::DBG, "Submit: Task(" +
boost::lexical_caststd::string(absPath) + ")");
Alternatively, to get a nicer interface for the caller, the log()
function could be templatized and take care of the streaming. Something
like:
template