Boost logo

Boost :

From: Manuel Jung (gzahl_at_[hidden])
Date: 2008-04-03 10:43:06


Hi John,

thanks for the code. But im still missing one point. How do i access the
data in the std::vector? I understand that it is in a shared pointer now.
The context obeject is not accessible from outside.
I have done this:

to_string To_String;

And than added this to my logger destinations:

g_l()->writer().add_destination( To_String );

Is this right, or do i have to write

g_l()->writer().add_destination( Bufferwriter.to_string() );

Greetings
Manuel

> Hi Manuel,
>
> Sorry for the late reply. Here it is:
>
> struct string_logger {
> std::vector<std::string> strs;
> };
>
> struct to_string :
> boost::logging::destination::class_<to_string,
> boost::logging::destination::implement_op_equal::has_context>,
> boost::logging::destination::non_const_context<string_logger> {
>
> bool operator==(const to_string& other) const { return &context() ==
> &other.context(); }
> void operator()(param msg) const {
> context().strs.push_back(msg);
> }
> };
>
> Best,
> John
>> Hi,
>> Thanks! Thats great, im looking forward to it :-)
>> Greetigns
>> Manuel
>>
>>
>>
>
>


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