Boost logo

Boost :

Subject: Re: [boost] [log] Review-ready version in the Vault
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-02-11 15:30:35


On 11 Feb 2009, at 19:28, Andrey Semashev wrote:

> vicente.botet wrote:
>>> I have some innocent questions: * Is logging thread-safe? * If
>>> yes, are the lines interleaved as it is the case for output
>>> streams? * If not could you point out how and where in the
>>> implementation this is handled?
>> Hi again,
>> well i have found some anwers to my questions on the document. I'll
>> come back later on.
>
> I'm glad you did. :)
>
>> How a log record is recognized, i.e. I don't see std::endl neither
>> std::flush are used in the examples. How many lines result in the
>> following example if condifiton is true (2 or 3)
>> src::logger_mt& lg = my_logger::get();
>> if (lg.open_record()) {
>> lg.strm() << "Hello ";
>> lg.strm() << "world!";
>> }
>
> That one is not valid in the current implementation. It should be
> replaced with:
>
> if (lg.open_record())
> lg.strm() << "Hello ";
> if (lg.open_record())
> lg.strm() << "world!";

What would happen if someone did write the above?

I really don't think this is an acceptable limitation. Don't you think
people will often write to a stream more than once in the same function?

Chris


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