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 an old version of boost. Click here for the latest Boost documentation.

Function template add_console_log



// In header: <boost/log/utility/setup/console.hpp>

template<typename CharT, typename... ArgsT> 
  shared_ptr< sinks::synchronous_sink< sinks::basic_text_ostream_backend< CharT > >> 
  add_console_log(std::basic_ostream< CharT > & strm, ArgsT...const & args);


The function constructs sink for the specified console stream and adds it to the core



Optional additional named arguments for the sink initialization. The following arguments are supported:

  • filter Specifies a filter to install into the sink. May be a string that represents a filter, or a filter lambda expression.

  • format Specifies a formatter to install into the sink. May be a string that represents a formatter, or a formatter lambda expression (either streaming or Boost.Format-like notation).

  • auto_flush A boolean flag that shows whether the sink should automatically flush the stream after each written record.


One of the standard console streams: std::cout, std::cerr or std::clog (or the corresponding wide-character analogues).


Pointer to the constructed sink.