Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Boost.Log(V2)中属性值的过滤器_C++_Logging_Boost - Fatal编程技术网

C++ Boost.Log(V2)中属性值的过滤器

C++ Boost.Log(V2)中属性值的过滤器,c++,logging,boost,C++,Logging,Boost,我试图创建一个类似log4c的Boost记录器。 用“文件”、“函数”、“行”等装饰我的日志记录。 还创建了一个自定义过滤器,它通过 bool Filter(const boost::log::attribute_value_set& set) { for (boost::log::attribute_value_set::const_iterator it=set.begin(); it != set.end(); ++it) { std::cout <&

我试图创建一个类似log4c的Boost记录器。 用“文件”、“函数”、“行”等装饰我的日志记录。 还创建了一个自定义过滤器,它通过

bool Filter(const boost::log::attribute_value_set& set)
{
  for (boost::log::attribute_value_set::const_iterator it=set.begin(); it != set.end(); ++it)
    {
      std::cout << "Name " << it->first << std::endl;
    }
[...]
}
bool过滤器(const boost::log::attribute\u value\u set&set)
{
for(boost::log::attribute_value_set::const_iterator it=set.begin();it!=set.end();+it)
{

std::cout好的。所以在执行过滤器后会附加常规属性(我觉得很奇怪,但事实就是这样)。所以我需要使用范围属性

dam。我完全忽略了这一点:www.boost.org/doc/libs/1_58_0/libs/log/doc/html/log/rational/why_attribute\u manips\u not\u impact\u filters.html
BOOST_LOG_GLOBAL_LOGGER_INIT( my_logger,boost::log::sources::severity_logger_mt < SeverityLevel > )
BOOST_LOG_SEV(my_logger::get(),level) << boost::log::add_value("Mask", mask) << boost::log::add_value("Line", line) << boost::log::add_value("File", File) << boost::log::add_value("Function", Function) << l_line;