
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.