I finally got it. Shared the answer on stack overflow: http://stackoverflow.com/a/32200033/3585934 Florian Lindner wrote:
Hello,
I try to implement that a log entry also logs its line number with boost::log. If any developer of it reads here, please also consider this a wishlist item...
I think the best way to add an additional attribute for it
core::get()->add_global_attribute( "Line", attributes::mutable_constant
(0) ); in my logger config that is called once at startup.
#define logInfo(methodname, message) \ boost::log::core::get()->get_global_attributes()["Line"].set(__LINE__); \ BOOST_LOG_SEV(_log, boost::log::trivial::severity_level::trace) << message \
Is my idea, but
boostlog.cpp:126:5: error: no member named 'set' in 'boost::log::v2_mt_posix::aux::attribute_set_reference_proxy'
getting the attribute somehow seems to work, but how can I set the value of the attribute?
Thanks! Florian