qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject [c++] formatting exception and log messages.
Date Fri, 26 Jan 2007 20:18:28 GMT
I've started using boost::format
http://www.boost.org/libs/format/index.html to format exception
messages, it's a convenient and flexible way to produce more informative
parameterized messages, e.g.:

throw ConnectionException(
  (boost::format("Invalid channel number %d.") %channelId).str());

It also takes one (very small) step closer to internationalizable
messages (because it separates the message text from parameters to the
message.) 

I'd recommend anyone working in C++ to do likewise unless there's a
better suggestion out there. We still need to figure out a more serious
logging/exception message strategy but I think boost::format will have a
place in that too.

Cheers,
Alan.


Mime
View raw message