void operator()(std::ostream& strm, logging::record const& rec) const { // We need to acquire the attribute value from the log record logging::visit< scope_stack > ( name_, rec.attribute_values(), boost::bind(&scope_list_formatter::format, boost::ref(strm), _1) ); }
//[ example_core_record_attr_value_lookup // Prints severity level by searching the attribute values void print_severity_lookup(logging::record const& rec) { logging::attribute_value_set const& values = rec.attribute_values(); logging::attribute_value_set::const_iterator it = values.find("Severity"); if (it != values.end()) { logging::attribute_value const& value = it->second; // A single attribute value can also be visited or extracted std::cout << value.extract< severity_level >() << std::endl; } }