使用默认全局记录器的Boost.Log自定义严重性

时间:2014-07-31 01:10:09

标签: c++ logging boost

我尝试使用Boost.Log v1.54设置自定义严重性级别虽然我已经遇到了迄今为​​止在任何Boost.Log stackoverflow条目中都没有提到的问题

以下是代码:

//Within ILogger abstract class header under public:
enum LogLevel
{
    kAll = 0,
    kDebug,
    kInfo,
    kWarning,
    kError,
    kFatal,
    kOff,
};


//Within Logger.cpp
#include "ILogger.h"

BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT( _logger, sources::severity_logger_mt< ILogger::LogLevel > )

以下是错误:

Boost_1_54\boost/log/sources/severity_feature.hpp(252): error C2664: 'boost::log::v2s_mt_nt5::sources::aux::severity_level<LevelT>::set_value' : cannot convert parameter 1 from 'const boost::log::v2s_mt_nt5::trivial::severity_level' to 'ILogger::LogLevel'
1>          with
1>          [
1>              LevelT=ILogger::LogLevel
1>          ]
1>          Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
1>          Boost_1_54\boost/log/sources/basic_logger.hpp(460) : see reference to function template instantiation 'boost::log::v2s_mt_nt5::record boost::log::v2s_mt_nt5::sources::basic_severity_logger<BaseT,LevelT>::open_record_unlocked<ArgsT>(const ArgsT &)' being compiled
1>          with
1>          [
1>              BaseT=boost::log::v2s_mt_nt5::sources::basic_logger<char,boost::log::v2s_mt_nt5::sources::severity_logger_mt<ILogger::LogLevel>,boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex>>,
1>              LevelT=ILogger::LogLevel,
1>              ArgsT=boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity,const boost::log::v2s_mt_nt5::trivial::severity_level>
1>          ]
1>          Logger.cpp(104) : see reference to function template instantiation 'boost::log::v2s_mt_nt5::record boost::log::v2s_mt_nt5::sources::basic_composite_logger<CharT,FinalT,ThreadingModelT,FeaturesT>::open_record<boost::parameter::aux::tagged_argument<Keyword,Arg>>(const ArgsT &)' being compiled
1>          with
1>          [
1>              CharT=char,
1>              FinalT=boost::log::v2s_mt_nt5::sources::severity_logger_mt<ILogger::LogLevel>,
1>              ThreadingModelT=boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex>,
1>              FeaturesT=boost::log::v2s_mt_nt5::sources::features<boost::log::v2s_mt_nt5::sources::severity<ILogger::LogLevel>>,
1>              Keyword=boost::log::v2s_mt_nt5::keywords::tag::severity,
1>              Arg=const boost::log::v2s_mt_nt5::trivial::severity_level,
1>              ArgsT=boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity,const boost::log::v2s_mt_nt5::trivial::severity_level>
1>          ]

0 个答案:

没有答案