Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class template basic_formatting_sink_frontend

boost::log::sinks::basic_formatting_sink_frontend — A base class for a logging sink frontend with formatting support.

Synopsis

// In header: <boost/log/sinks/basic_sink_frontend.hpp>

template<typename CharT> 
class basic_formatting_sink_frontend : public basic_sink_frontend {
public:
  // types
  typedef CharT                          char_type;       // Character type. 
  typedef std::basic_string< char_type > string_type;     // Formatted string type. 
  typedef basic_formatter< char_type >   formatter_type;  // Formatter function object type. 
  typedef formatter_type::stream_type    stream_type;     // Output stream type. 

  // member classes/structs/unions

  struct formatting_context {
    // member classes/structs/unions

    class cleanup_guard {
    public:
      // construct/copy/destruct
      explicit cleanup_guard(formatting_context &) noexcept;
      cleanup_guard(cleanup_guard const &) = delete;
      cleanup_guard & operator=(cleanup_guard const &) = delete;
      ~cleanup_guard();
    };
    // construct/copy/destruct
    formatting_context();
    formatting_context(unsigned int, std::locale const &, 
                       formatter_type const &);

    // public data members
    const unsigned int m_Version;    // Object version. 
    string_type m_FormattedRecord;    // Formatted log record storage. 
    stream_type m_FormattingStream;    // Formatting stream. 
    formatter_type m_Formatter;    // Formatter functor. 
  };

  // construct/copy/destruct
  explicit basic_formatting_sink_frontend(bool);

  // public member functions
  template<typename FunT> void set_formatter(FunT const &);
  void reset_formatter();
  std::locale getloc() const;
  void imbue(std::locale const &);

  // protected member functions
  formatter_type & formatter();
  template<typename BackendMutexT, typename BackendT> 
    void feed_record(record_view const &, BackendMutexT &, BackendT &);
  template<typename BackendMutexT, typename BackendT> 
    bool try_feed_record(record_view const &, BackendMutexT &, BackendT &);
};

Description

basic_formatting_sink_frontend public construct/copy/destruct

  1. explicit basic_formatting_sink_frontend(bool cross_thread);
    Initializing constructor.

    Parameters:

    cross_thread

    The flag indicates whether the sink passes log records between different threads

basic_formatting_sink_frontend public member functions

  1. template<typename FunT> void set_formatter(FunT const & formatter);

    The method sets sink-specific formatter function object

  2. void reset_formatter();

    The method resets the formatter

  3. std::locale getloc() const;

    The method returns the current locale used for formatting

  4. void imbue(std::locale const & loc);

    The method sets the locale used for formatting

basic_formatting_sink_frontend protected member functions

  1. formatter_type & formatter();
    Returns reference to the formatter.
  2. template<typename BackendMutexT, typename BackendT> 
      void feed_record(record_view const & rec, BackendMutexT & backend_mutex, 
                       BackendT & backend);
    Feeds log record to the backend.
  3. template<typename BackendMutexT, typename BackendT> 
      bool try_feed_record(record_view const & rec, BackendMutexT & backend_mutex, 
                           BackendT & backend);
    Attempts to feeds log record to the backend, does not block if backend_mutex is locked.

PrevUpHomeNext