Boost logo

Boost :

From: Manuel Jung (gzahl_at_[hidden])
Date: 2008-03-30 11:40:23


Hi,

I would like to log to a standard container like std::list<std::string> or
something similar, so i can send my logs to another program over network.
But i have problems defining my own destination. For now it would be ok, to
log just to a string. But i don't understand how to define my own
destination in the right way. I looked at
http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1manipulator.html#manipulator_create
but i don't understand the "sharing data" part well. Maybe someone can help
me out here?

I have so far:
struct to_string : boost::logging::destination::class_<to_string,
boost::logging::destination::implement_op_equal::has_context> {
    std::string s;
    to_string(std::string s) : s(s) {}

    bool operator==(const to_string& other) { return s == other.s; }

    // param = const std::string&
    // (in other words, it's the arg_type from your destination base class)
    void operator()(param msg) const {
    // s.append(msg);
    }

But even that is not compiling. Any help would be appreciated! :-)
Greetings
Manuel Jung


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