|
Boost : |
From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-11-26 18:39:48
At 4:28 PM -0500 11/26/01, David A. Greene wrote:
>Ok, I don't understand then what you mean by "take optional
>arguments...to modify the formatting." What formatting are you
>modifying?
It's the ToStr methods:
LOG(NULL, "pi = ", ToStr(pi, 3));
would print pi to 3 decimal places.
> > There's no support for line numbers. I haven't seen a need for
>> anything like that.
>
>
>I always thought it would be nice for my users to scream at me
>and then tell me where the problem is. :) A unique ID for each
>(static) message would be almost as good.
It's useful with asserts, but I can't think of anyplace where I've
used logging where it would be helpful.
>Gotcha. I like that messages can go to multiple sinks.
>
>>> From your usage in the previous message, it looks like each
>>>variable in the message is passed as a separate parameter. Doesn't
>>>that require a whole lot of overloaded methods?
>>
>> Currently I support LOG functions with up to 10 custom arguments so I
>> have just over 10 overloaded functions. (Actually I have another 10
>> because there's a debug only version called TRACE).
>
>
>This seems excessive to me. It's certainly not scalable. But maybe
>log messages are short enough that it doesn't matter.
I've gotten up to eight or nine arguments so ten is probably a bit
too small. OTOH if someone is using LOG with too many arguments they
could just call LOG more than once...
> >>Of course the presents the (probably likely) chance that the programmer
>>>will mis-type the category in some message and never see it (since he
>>>doesn't know the name of the category to turn on). Though inn a
>>>GUI he will at least get some strange menu entries. :)
>>
>> Yep, and it is pretty obvious in a GUI app. In other apps I think
>> you'd still want to do something similar. For example, in the past
>> I've had app's that wrote the categories to an XML file on shutdown
>> and read from that file on startup. This way everyone on the team
>> could easily customize the logging output for the stuff they were
>> interested in. This isn't as in your face as a menu, but I think
>> misspelled categories would still be found fairly quickly.
>
>You're probably right, but I'm a fail-fast kinda guy. :)
Me too, but there are nice advantages to using strings and the
failure consequences are pretty mild.
-- Jesse
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk