Boost logo

Boost Users :

Subject: Re: [Boost-users] [log] connecting a logger to a specific sink
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2013-12-04 06:59:19


I think you need to read the attribute page in details but you mostly get
it apparently.
http://boost-log.sourceforge.net/libs/log/doc/html/log/tutorial/attributes.html

Basically, you don't associate attribute to loggers but to log record.
In your case I think the simplest way would be to have a different logging
macro (or function),
that would do the log record setup and send manually but will add necessary
attributes in the middle.

See the example of manual logging (or see the boost log macros
implementations):

void manual_logging()
{
    src::severity_logger< severity_level > slg;

    logging::record rec = slg.open_record(keywords::severity = normal);
     /// HERE ADD NECESSARY ATTRIBUTE THAT WILL BE FILTERED BY SINKS
    if (rec)
    {
        logging::record_ostream strm(rec);
        strm << "A regular message";
        strm.flush();
        slg.push_record(boost::move(rec));
    }
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net