Boost C++ Libraries

PrevUpHomeNext

Class template fmt_chain

boost::log::formatters::fmt_chain — A formatter compound that encapsulates two other formatters.

Synopsis

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

template<typename CharT, typename LeftFmtT, typename RightFmtT> 
class fmt_chain :
  public basic_formatter< CharT, fmt_chain< CharT, LeftFmtT, RightFmtT > >
{
public:
  // types
  typedef base_type::ostream_type ostream_type;  // Stream type. 
  typedef base_type::record_type  record_type;   // Log record type. 

  // construct/copy/destruct
  template<typename RightT> fmt_chain(LeftFmtT const &, RightT const &);

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

Description

The formatting lambda expressions are decomposed by compiler into a sequence of binary operators. This formatter does nothing but to connect two other formatters that participate in such an expression. When invoked, the formatter simply calls its first (or left-hand) aggregated formatter and then calls its second (right-hand) formatter.

Chaining formatters can be composed into trees which allows to construct arbitrary-sized formatting lambda expressions.

fmt_chain public construct/copy/destruct

  1. template<typename RightT> 
      fmt_chain(LeftFmtT const & left, RightT const & right);

    Constructor

    Parameters:
    left

    Left-hand formatter

    right

    Right-hand formatter

fmt_chain public member functions

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

    Formatting operator. Passes control to the left and right formatters.

    Parameters:
    record

    The logging record

    strm

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


PrevUpHomeNext