Boost C++ Libraries

PrevUpHomeNext

Class template fmt_attr_formatted

boost::log::formatters::fmt_attr_formatted — Generic attribute value formatter.

Synopsis

// In header: <boost/log/formatters/attr.hpp>

template<typename CharT, typename AttributeValueTypesT, 
         typename ExceptionPolicyT> 
class fmt_attr_formatted : public basic_formatter< CharT, fmt_attr_formatted< CharT, AttributeValueTypesT, ExceptionPolicyT > >
{
public:
  // types
  typedef base_type::char_type      char_type;     // Character type. 
  typedef base_type::string_type    string_type;   // String type. 
  typedef base_type::ostream_type   ostream_type;  // Stream type. 
  typedef basic_format< char_type > format_type;   // Boost.Format object type. 
  typedef base_type::record_type    record_type;   // Log record type. 

  // construct/copy/destruct
  explicit fmt_attr_formatted(string_type const &, string_type const &);

  // public member functions
  void operator()(ostream_type &, record_type const &) const;
};

Description

The fmt_attr_formatted formatter converts the attribute value to a string by passing it to a Boost.Format formatter. The formatter is initialized with a format string that may specify the exact representation of the formatted data.

The formatter can either accept a single attribute value type or a sequence of types.

fmt_attr_formatted public construct/copy/destruct

  1. explicit fmt_attr_formatted(string_type const & name, string_type const & fmt);

    Constructor with attribute name and format string initialization

    Parameters:
    fmt

    Format string. Must be compatible with Boost.Format and contain a single placeholder. The placeholder must be compatible with all attribute value types specified in AttributeValueTypesT

    name

    Attribute name

fmt_attr_formatted public member functions

  1. void operator()(ostream_type & strm, record_type const & record) const;

    Formatting operator. Formats the attribute with the specified on construction name from attrs and puts the result into the strm stream.

    Parameters:
    record

    A logging record

    strm

    A reference to the stream, where the final text of the logging record is composed


PrevUpHomeNext