Boost logo

Boost Users :

Subject: [Boost-users] Include line number in boost logs
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2015-08-24 11:27:16


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<size_t>(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


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