我正在创建新的接收器,如下例所示:
void init()
{
logging::add_file_log
(
keywords::file_name = "sample_%N.log",
keywords::rotation_size = 10 * 1024 * 1024,
keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),
keywords::format = "[%TimeStamp%]: %Message%"
);
logging::core::get()->set_filter
(
logging::trivial::severity >= logging::trivial::info
);
}
我已经实现了自己的过滤器对象:
struct MyFilter {
...
bool operator()(const boost::log::attribute_value_set& attrs) const noexcept
{
bool result = ....
// Do my filtering
return result;
}
...
};
如何将其作为接收器初始化参数传递?即我想添加以下参数:
keywords::filter = SOMETHING(MyFilter())
但到目前为止,我无法弄清楚“某事”应该是什么。找不到任何例子。你能帮我么?