Boost logo

Boost :

From: Sean Hunt (rideau3_at_[hidden])
Date: 2008-03-18 20:56:33


John Torjo wrote:
> Yes - my problem is that each person seems to have a different opinion
> of what "simple case". However, what I'll do is this:
> - have a few simple cases, and write the code for them
> - minimize the number of lines I write in order to meet a certain case
> - question: what do you think it's a reasonable number of lines, for a
> simple case? I'd go for 5-10 lines of code.
>
> About those simple cases : the problem is that I have my own simple
> cases - which might not be what you want.
> So, if you have your great simple case, shout!
>
> On a side-note - I'll make a couple of web pages where I'll split the
> work to be done. Then, you all are most welcome to comment on them.
>
My example of a simple case might be something like this:

I want to log to a file, with three levels of logging. So I might want
to do the following (just an example! Not trying to mandate an interface
or anything):

#include <boost/log.hpp>

using namespace boost;
using namespace boost::log;

log<to_file<some_template_tricks>> my_log(warning);

// some function
{
my_log(error)<<"Error! Something went wrong!";
}

The some_template_tricks is just there because you can't put string
literals in a template - if we had to make our own streams and template
them, that would be okay. And the use of warning and error are just
error-checking conditions - if I construct it with warning as the
parameter, then only stuff that's a warning level or more serious can be
logged. I would define a concept to indicate a set of conditions and
allow those to be passed in as a template parameter. If you look at the
kind of genericism in multi_index, that is the kind of thing I'd like to
see more of - lots of stuff that's easily avoided if you don't need it,
but generic and powerful if you do.

As for the documentation, I think that Doxygen is fine, but things need
to be sorted better, and the reuse of identifiers in lots of different
namespaces definitely hurts. Especially when it comes to linkage - you
have names in the documentation that are mislinked because you have them
in 4 different namespaces and Doxygen can't figure out which one you are
trying to refer to. Long names aren't too much of an issue, particularly
in types. If something can be typedefed away, then it makes stuff look
good and has the nice scoping to go with it.

I really want to see a logging library in boost, as boost is frequently
the first place I look for a nice, reliable, portable library. It's
definitely something I would like to see in the future, because I really
want to have a nice interface that I don't end up reinventing every time
I start a new project.

Sean


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