Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2005-08-18 08:49:11


Darryl Green wrote:
> Excuse the break in threading - gmane has lost/missed a lot of boost traffic.
>
> Hi John,
> I've only had a quick look at the latest version:
>
> The m_destroyed hack needs to go - this should only be relevant for static (not
> scoped) logs and the real issue is that you need to do thread-safe singletons -
> ie. you need to use posix call_once or equivalent to contstruct the thing.
> Destruction is a bit tricky - not doing it seems a reasonable option, though
> stopping leak detectors from compaining would be nice.

I don't think construction is tricky. I think knowing whether I'm still
constructed - that's the problem. And for scoped logs, you can simply
ignore it.

>
> The scoped log stuff doesn't seem to have been updated to support levels yet -
> in fact I'm not sure if it currently works?

It does work, and it does support levels: BOOST_SCOPEDLOG and
BOOST_SCOPEDLOGL

>
> I think (fancy that - given the way it was in analog ;-)) that the named
> appenders need to be managed - currently, you can create multiple appenders
> with the same name, then when you delete by name you delete all appenders with
> that name. I don't see the utility of that model, which when combined with the
> wildcard matching is really fairly hard to use. For example, suppose I have an
> appender that logs to some sort of display for "real time" tracing. First off,
> I say:
>
> manipulate_logs("error.*").add_appender(displaywrite, "display")
>
> Then I notice an error about some component foo and decide to look at more
> detail about foo:
>
> manipulate_logs("*.foo").add_appender(displaywrite, "display")
>
> Now I get anything logged to "error.foo" written to "display" twice.
>
> I then say:
>
> manipulate_logs("error.*").del_appender("display")
>

You're right. What comes to mind, is to have an extra parameter:
bool add_even_if_name_exists.

So, if passing 'false', if "display" already exists, it's not added. If
passing 'true', "display" is added even if it exists.

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter)
-- http://www.torjo.com/cb/ - Click, Build, Run!

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