...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::sinks::basic_formatting_sink_frontend — A base class for a logging sink frontend with formatting support.
// 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 &); };
basic_formatting_sink_frontend
public member functionstemplate<typename FunT> void set_formatter(FunT const & formatter);
The method sets sink-specific formatter function object
void reset_formatter();
The method resets the formatter
std::locale getloc() const;
The method returns the current locale used for formatting
void imbue(std::locale const & loc);
The method sets the locale used for formatting
basic_formatting_sink_frontend
protected member functionsformatter_type & formatter();Returns reference to the formatter.
template<typename BackendMutexT, typename BackendT> void feed_record(record_view const & rec, BackendMutexT & backend_mutex, BackendT & backend);Feeds log record to the backend.
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.