Boost logo

Boost Users :

From: Nat Goodspeed (nat_at_[hidden])
Date: 2008-06-09 09:06:38


Mojmir Svoboda wrote:

> oh, you almost got me there.. i did not considered these << operators
> when designing. mainly because of their annoying syntax. i am simple
> man i prefer that one of printf :) (or boost::format)

Speaking only for myself -- I wouldn't use a logging library that didn't
support << operators.

For years now I've been in the habit of defining a custom << operator
for each important class in my applications. Then I can debug by writing
such an object to std::cout -- or to a log file. Or, using
std::ostringstream, I can convert to a string representation if I have
something more exotic in mind (e.g. output to a debug pane in a GUI).

My point is that this single operator<< method suffices for all present
cases in which I want to display my new object. Even if a printf-style
logging library is extensible using some different mechanism -- why
should I bother? I'd just pick a library (or write my own) based on <<
instead.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net