Phlip wrote:
Such a library has so few technical challenges that maybe nobody bothered to
publish. Roll your own, use an std::ostream and correctly written
operator<<, and you'l be done in no time.
Actually, there are some technical challenges. Maybe you have some
insight into a solution to my troubles.
I have written a logging class that one uses as follows:
Debug::log(3) << "Log message at debuglevel 3\n";
Any time the Debug object is told to log something at a debuglevel that
is above the global debuglevel, it just ignores it. With me so far?
The problem is, I tend to have these sprinkled very liberally in my
code. In an inner-loop, there is a very high cost to converting the
object to strings, even if they are going to be not going to be output
because the debuglevel is too high.
The question is, is there a way to "short-circuit" this cost, if we
know that the text is not actually going to be output?
Joseph