Boost logo

Boost :

From: John Torjo (john.groups_at_[hidden])
Date: 2008-02-12 12:37:26


AMDG

John Torjo wrote:
> Steven Watanabe wrote:
>
>> Gather: What exactly are the requirements? The docs say "a function
>> that will
>> gather the data - called .out()" What are the requirements on the
>> return type? Further in scenarios_code.html#scenarios_code_mon
>> there
>> is the definition void *out(const char* msg) { m_msg = msg;
>> return this; }
>> Is out() called implicitly or not? Why is "this" returned as a
>> void*?
>> Confused...
>>
>>
> The requirements are to return a void* pointer.
> This is needed when http://torjo.com/log2/doc/html/caching.html and you
> want to cache the filter as well.
>
> If I remove the usage of
> http://torjo.com/log2/doc/html/caching.html#caching_BOOST_LOG_BEFORE_INIT_CACHE_FILTER
> then you can return anything you like.
> For more details, please take a look at cache_before_init_macros.hpp,
> line 50
>

I just thought of a way to avoid this requirement.

if(!is_enabled); else
for(int i = 0; i == 0;)
     for(bool (*f)(); i < 3; ++i)
         if(i == 0) {
             struct local {
                 bool do_filter() { return(/is_enabled/); }
             };
             f = &local::is_enabled;
         } else if(i == 2) {
             // cache filter.
         } else //do logging

Wow, that's brilliant!
Thanks!

Best,
John

-- 
http://John.Torjo.com -- C++ expert
http://blog.torjo.com
... call me only if you want things done right

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