Boost logo

Boost :

From: David A. Greene (greened_at_[hidden])
Date: 2001-11-28 11:56:55


Jesse Jones wrote:

>>Well, I'd think we'd want some sort of panic/assert message support,
>>and if we have that, why not include a line-number option for
>>all logging?
>
> Asserts and logging are two entirely different things. For asserts
> you often get messages like "assert failed: x > 0". This doesn't
> provide nearly enough information to locate the problem so people
> tack on other stuff like the file and line number. But for logging
> all you're really interested in is the text; you don't care where it
> came from. At least, that's been my experience...

Depends what you mean by "logging." There are activity logs and
there are debug logs. For debug logs I can imagine one might
want to know location information.

Perhaps we do need to separate these out, though. I don't know.

One idea I had to improve the usefulness of assert message is to
print out the values causing the failure. So if assert(x < 0)
fails it would be nice if the value of x could be printed.
This can be generalized to dump the state of any object causing
an assert. Obviously it doesn't work for everything, but it
would be nice to have a "smart assert" available. Is this
even possible?

>>Maybe it's not always needed, but are there serious
>>downsides to including it? Yes, the preprocessor, but is there
>>anything _else_? :)
>
> Why complicate the design for a feature that very few people are
> likely to use? And if they do want it they can use the __LINE__ macro
> themselves.

I can see your point for regular activity logs _a_la_ Apache.
But I would like my debug messages to maybe be tagged with
line number information (but not always :)).

                               -Dave

-- 
"Some little people have music in them, but Fats, he was all music,
  and you know how big he was."  --  James P. Johnson

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk