Boost logo

Boost :

Subject: Re: [boost] Boost log issues and workarounds
From: hh h (jupiter.hce_at_[hidden])
Date: 2019-01-18 03:45:04

Hi Andrey,

> Those are just examples in the docs. These particular examples don't
> exist as standalone files. You can find global loggers used in a number
> of other examples in the libs/log/example directory.

The global loggers is working well, but I could not compile the local
log severity, here is the code:

boost::log::sources::channel_logger_mt< >,
(boost::log::keywords::channel = "general"))

typedef enum {
} ServerityLevel_t;

template<typename CharT, typename TraitsT> std::basic_ostream< CharT,
TraitsT >& operator << (std::basic_ostream< CharT, TraitsT >& strm,
ServerityLevel_t lvl) {
    static const char* const str[] = {
    if (static_cast< std::size_t >(lvl) < (sizeof(str) / sizeof(*str))) {
        strm << str[lvl];
    } else {
        strm << static_cast< int >(lvl);
    return strm;

#define LOG(severity) BOOST_LOG_STREAM_WITH_PARAMS((my_logger::get()),
PathToFilename(__FILE__)))(SetGetAttrib("LineNumber", (unsigned

/usr/include/boost/log/sources/channel_feature.hpp:171:60: error: no
match for ‘operator[]’ (operand types are ‘const ServerityLevel_t’ and
const boost::parameter::void_>’)
         return open_record_with_channel_unlocked(args,
args[keywords::channel | parameter::void_()]);

Obviously, you used BOOST_LOG_SEV where I was using
BOOST_LOG_STREAM_WITH_PARAMS, the compiler seems to complain missing
operator[], but I have no clue how to define it.

Thank you.

Boost list run by bdawes at, gregod at, cpdaniel at, john at