How to log line number of coder in boost log 2.0?

boost-log

Solution

I struggled with this, until I found this snippet

#define LFC1_LOG_TRACE(logger) \
BOOST_LOG_SEV(logger, trivial::trace) << "(" << __FILE__ << ", " << __LINE__ << ") "

Works like a charm

Problem

Can I use LineID attribute for this? I hope I could use sink::set_formatter to do this instead of using ``` __LINE__ ``` and ``` __FILE__ ``` in each log statement.

Original source