logging C++ objects

8 views
Skip to first unread message

Ionutz

unread,
Oct 29, 2008, 11:39:45 AM10/29/08
to rlog-users
Hi,

Many C++ classes come with 'ostream& operator<<(ostream&, const class&
C)' style operators.

How can these be used with rLog?
Is there a recommended way to do it?

I have used something like this:

std::string person2str(const Person& p)
{
std::stringstream os;
os << p;
return os.str();
}
...
rDebug("bad person: %s", person2str(p).c_str());

Is there a better way to do it?

Thanx,

Ionutz
Reply all
Reply to author
Forward
0 new messages