Try basic boost.log example but failed
I am integrating Boost.log v2 into my project. The platform is windows 10 with vs2017. The program is compiled target x64.
#include <boost/thread/mutex.hpp>
#include <boost/core/null_deleter.hpp>
#include <boost/log/common.hpp>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/attributes.hpp>
#include <boost/log/exceptions.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/sinks.hpp>
void test(){
boost::log::sources::severity_logger<severity_level> slg1;
slg1.open_record(); // this is ok
slg1.open_record(normal); // this line failed at next code
}
template< typename BaseT, typename LevelT = int >
class basic_severity_logger : public BaseT
{
template< typename ArgsT >
record open_record_unlocked(ArgsT const& args)
{
// !!! error at here !!!
// because "normal" is an enum variable that doesn't support "operator[]"
m_SeverityAttr.set_value(args[keywords::severity | m_DefaultSeverity]);
return base_type::open_record_unlocked(args);
}
};
Actually, I don't know how basic_severity_logger
is called ?
// logger with multithread supported
boost::log::sources::severity_logger_mt<severity_level> slg;
slg.open_record(); // failed with "no member named 'open_record' in severity_logger_mt<...>"
slg.open_record(DEBUG); // failed with "no member named 'open_record' in severity_logger_mt<...>"
Currently, the code failed at compling step, not reaching linking stage yet.
I have tried boost-1.64, boost-1.68 and boost-1.70, the problem remains the same
Could anyone help me ?
error mesage for first part of code
D:\libraries\boost\boost_1_70_0\boost/log/sources/severity_feature.hpp(252): error C2676: binary “[”:“const ArgsT”does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
ArgsT=severity_level
]