Boost logo

Boost :

Subject: Re: [boost] [log] Review-ready version in the Vault
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-02-11 04:10:19


>>> boost::log log1(name);
>>> boost::log log2(name); // The same as log1
>>
>> I'm curious ti know how do you retrieve the same log by name without
>> static initialization?
>
> This is what my example does, if I understand you correctly. The logger is
> initialized only when first requested.

Well, I am under impression that Andrey's solution is somewhat different
from what I have in mind. Although I must say my implementation is fairly
conventional -- a logger (like boost::log) is actually a handle/proxy with
pointer semantics, like

    shared_ptr<actual-logger>

Internally, I maintain a name/logger map and, when

    boost::log log(name);

is requested, I simply return another reference/handle to the respective
internal logger implementation (here it seems to differ from Andrey's). If a
logger with the requested name does not, I create one.

V.


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