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


Class template basic_exception_handler_logger

boost::log::sources::basic_exception_handler_logger — Exception handler feature implementation.


// In header: <boost/log/sources/exception_handler_feature.hpp>

template<typename BaseT> 
class basic_exception_handler_logger : public BaseT {
  // types
  typedef base_type::threading_model                                                               threading_model;         // Threading model being used. 
  typedef base_type::final_type                                                                    final_type;              // Final logger type. 
  typedef unspecified                                                                              exception_handler_type;  // Exception handler function type. 
  typedef strictest_lock< typename base_type::open_record_lock, no_lock< threading_model > >::type open_record_lock;        // Lock requirement for the open_record_unlocked method. 
  typedef strictest_lock< typename base_type::push_record_lock, no_lock< threading_model > >::type push_record_lock;        // Lock requirement for the push_record_unlocked method. 
  typedef unspecified                                                                              swap_lock;               // Lock requirement for the swap_unlocked method. 

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

  // public member functions
  template<typename HandlerT> void set_exception_handler(HandlerT const &);

  // protected member functions
  template<typename ArgsT> record open_record_unlocked(ArgsT const &);
  void push_record_unlocked(record &&);
  void swap_unlocked(basic_exception_handler_logger &);


basic_exception_handler_logger public construct/copy/destruct

  1. basic_exception_handler_logger();

    Default constructor. The constructed logger does not have an exception handler.

  2. basic_exception_handler_logger(basic_exception_handler_logger const & that);

    Copy constructor

  3. basic_exception_handler_logger(basic_exception_handler_logger && that);

    Move constructor

  4. template<typename ArgsT> 
      explicit basic_exception_handler_logger(ArgsT const & args);

    Constructor with arguments. Passes arguments to other features.

basic_exception_handler_logger public member functions

  1. template<typename HandlerT> 
      void set_exception_handler(HandlerT const & handler);

    The method sets exception handler function. The function will be called with no arguments in case if an exception occurs during either open_record or push_record method execution. Since exception handler is called from a catch statement, the exception can be rethrown in order to determine its type.

    By default no handler is installed, thus any exception is propagated as usual.

    See Also:


    [Note] Note

    The exception handler can be invoked in several threads concurrently.

    [Note] Note

    Thread interruptions are not affected by exception handlers.



    Exception handling function

basic_exception_handler_logger protected member functions

  1. template<typename ArgsT> record open_record_unlocked(ArgsT const & args);

    Unlocked open_record

  2. void push_record_unlocked(record && rec);

    Unlocked push_record

  3. void swap_unlocked(basic_exception_handler_logger & that);

    Unlocked swap