|
Boost : |
From: John Torjo (john.groups_at_[hidden])
Date: 2008-02-05 18:12:52
> AMDG
>
>
What does that mean?
>
>> To answer your question : you can use shared_ptr, but the recommended
>> way is to use non_const_context.
>>
>
> And in addition, non_const_context is a slightly higher level of
> abstraction.
>
Yes :)
> The disadvantage I see is that copying such a manipulator may cause
> surprises
> and using shared_ptr directly makes it more obvious that copying doesn't
> quite
> have normal semantics.
>
http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1manipulator.html#manipulator_manipulate
>
>
>> Depends on what you want - the library is very flexible when it comes
>> to filters. The simplest level holders looks like this:
>>
>> // the higher the level, the more critical the message
>> struct level_filter {
>> level_filter(int default_level = 0) : m_level(default_level) {}
>> bool is_enabled(int level) const { return level >= m_level; }
>> void set_enabled(int level) {
>> m_level = level;
>> }
>> private:
>> int m_level;
>> };
>>
>
> So the minimum needed to interoperate with LOG_IF_LEVEL is
> bool is_enabled(int level)?
>
>
Yes.
>> They don't work like that. A formatter gets a string as argument to
>> its operator(), and it manipulates that string.
>> So each manipulator works isolated from the other formatters.
>>
>
> In place manipulation. Doh. (Sounds like I've been doing too much
> functional programming recently)
>
>
:)
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