|
Boost : |
Subject: Re: [boost] boost log to display source code name and lines
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-12-28 08:24:58
On 12/28/18 10:42 AM, hh h wrote:
> I'd like to run a macro which can display file name and code lines by
> calling LOG(debug) << "debug here"; the following example answered Mar
> 10 '16 at 8:50 by jma looks good, but I could not compile it, I am
> running on ubuntu 18 that the boost version is 1.65:
>
> https://stackoverflow.com/questions/35895199/boost-log-and-severity-local-attributes/api.stackexchange.com
>
> error: no matching function for call to
> ‘boost::log::v2_mt_posix::core::add_sink(std::shared_ptr<boost::log::v2_mt_posix::sinks::synchronous_sink<boost::log::v2_mt_posix::sinks::text_file_backend>
>> &)’
> logging::core::get()->add_sink(sink);
Boost.Log uses boost::shared_ptr, not std::shared_ptr.
> Another one in following link even got more errors I won't be bothered to post.
>
> http://gernotklingler.com/blog/simple-customized-logger-based-boost-log-v2/
>
> error: missing template arguments before ‘logger’
> boost::log::sources::severity_logger_mt logger;
> ......
The quoted code sample in the linked blog page is indeed missing
template arguments in a few places. The original code on GitHub
(https://github.com/gklingler/simpleLogger) seems to be better, although
I didn't try to compile it. I guess, some parts got lost in the blog due
to missing HTML escaping.
PS: Don't top-post, please.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk