Boost logo

Boost :

From: Mark Blewett (boost_at_[hidden])
Date: 2005-04-30 17:29:12


At 19:42 29/04/2005, you wrote:

>"Daniel Frey" <d.frey_at_[hidden]> wrote in message
>news:d4tshu$h4t$1_at_sea.gmane.org...
> > John Torjo wrote:
> >> I've just updated the Boost Log Library:
> >> http://torjo.com/code/logging-v132.zip
> >
> > It's good to see progress on logging and what I've seen so far looks
> > promising. However...
> >
> >> BOOST_LOG(app) << "testing " << i << '-' << j << '-' << k << std::endl;
> >> BOOST_LOG(dbg) << "this is a debug message, i=" << i << std::endl;
> >> BOOST_LOG(info) << "I just wanted to tell you something....";
> >
> > ...while I like the feeling of the stream approach from a user's
> > perspective, there is one (IMHO important) feature that can not be
> > implemented with it: Exception guards.
>
>Another thing (from the same domain) that I found especially difficult to
>deal with in my logging implementation is "intermixed logging":
>
>BOOST_LOG(..) << "Print result of f(): " << f();
>
>...
>void f() {
> BOOST_LOG(..) << "Enter f()";
>...
> BOOST_LOG(..) << "Exit f()";
>}
>
>Now to make it properly formatter isn't trivial at all.
>
>Gennadiy

I must admit I haven't looked at the proposed implementation due to time
issues, tho I'm very interested in a logging library.

Like most people have written my own... with various traces / levels and
logging to a file / std out / across a tcp/ip connection etc, and hence
such a library a very worthwhile addition to Boost in my opinion.

But sorry I don't see what the issue is about properly formatting...
perhaps you could explain a bit more please?

 From my point of view if you have something like;

class log
{
public:
         void output(const std::string& message); // threadsafe
write msg to log
};

class logger
{
public:
         logger(log& l) : l(l) {}
         ~logger() { l.output(buffer) {
         friend logger& operator << (logger&, const char*); // write
to buffer
};

Your example would end up with

Enter f()
Exit f()
Print result of f(): ...

Regards
Mark


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