Boost C++ Libraries 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 a snapshot of the develop branch, built from commit 3e77cd019e.

Class text_multifile_backend

boost::log::sinks::text_multifile_backend — An implementation of a text multiple files logging sink backend.


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

class text_multifile_backend : public basic_formatted_sink_backend< char > {
  // types
  typedef base_type::char_type   char_type;                // Character type. 
  typedef base_type::string_type string_type;              // String type to be used as a message text holder. 
  typedef unspecified            file_name_composer_type;  // File name composer functor type. 

  // construct/copy/destruct
  template<typename... ArgsT> 
    explicit text_multifile_backend(ArgsT... const &);

  // public member functions
  template<typename ComposerT> void set_file_name_composer(ComposerT const &);
  void set_auto_newline_mode(auto_newline_mode);
  void consume(record_view const &, string_type const &);


The sink backend puts formatted log records to one of the text files. The particular file is chosen upon each record's attribute values, which allows to distribute records into individual files or to group records related to some entity or process in a separate file.

text_multifile_backend public construct/copy/destruct

  1. text_multifile_backend();

    Default constructor. The constructed sink backend has no file name composer and thus will not write any files. All other parameters are set to their defaults.

  2. template<typename... ArgsT> 
      explicit text_multifile_backend(ArgsT... const & args);

    Constructor. Creates a sink backend with the specified named parameters. The following named parameters are supported:

    • auto_newline_mode - Specifies automatic trailing newline insertion mode. Must be a value of the auto_newline_mode enum. By default, is auto_newline_mode::insert_if_missing.

  3. ~text_multifile_backend();


text_multifile_backend public member functions

  1. template<typename ComposerT> 
      void set_file_name_composer(ComposerT const & composer);

    The method sets file name composer functional object. Log record formatters are accepted, too.



    File name composer functor

  2. void set_auto_newline_mode(auto_newline_mode mode);

    Selects whether a trailing newline should be automatically inserted after every log record. See auto_newline_mode description for the possible modes of operation.



    The trailing newline insertion mode.

  3. void consume(record_view const & rec, string_type const & formatted_message);

    The method writes the message to the sink