1 /* 2 * Copyright Andrey Semashev 2007 - 2015. 3 * Distributed under the Boost Software License, Version 1.0. 4 * (See accompanying file LICENSE_1_0.txt or copy at 5 * http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 /*! 8 * \file support/exception.hpp 9 * \author Andrey Semashev 10 * \date 18.07.2009 11 * 12 * This header enables Boost.Exception support for Boost.Log. 13 */ 14 15 #ifndef BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ 16 #define BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ 17 18 #include <boost/type_index.hpp> 19 #include <boost/exception/info.hpp> 20 #include <boost/log/detail/config.hpp> 21 #include <boost/log/attributes/attribute_name.hpp> 22 #include <boost/log/attributes/named_scope.hpp> 23 #include <boost/log/detail/header.hpp> 24 25 #ifdef BOOST_HAS_PRAGMA_ONCE 26 #pragma once 27 #endif 28 29 namespace boost { 30 31 BOOST_LOG_OPEN_NAMESPACE 32 33 /*! 34 * Attribute name exception information 35 */ 36 typedef error_info< struct attribute_name_info_tag, attribute_name > attribute_name_info; 37 38 /*! 39 * Type info exception information 40 */ 41 typedef error_info< struct type_info_info_tag, typeindex::type_index > type_info_info; 42 43 /*! 44 * Parse position exception information 45 */ 46 typedef error_info< struct position_info_tag, unsigned int > position_info; 47 48 /*! 49 * Current scope exception information 50 */ 51 typedef error_info< struct current_scope_info_tag, attributes::named_scope_list > current_scope_info; 52 53 /*! 54 * The function returns an error information object that contains current stack of scopes. 55 * This information can then be attached to an exception and extracted at the catch site. 56 * The extracted scope list won't be affected by any scope changes that may happen during 57 * the exception propagation. 58 * 59 * \note See the \c named_scope attribute documentation on how to maintain scope list. 60 */ current_scope()61inline current_scope_info current_scope() 62 { 63 return current_scope_info(attributes::named_scope::get_scopes()); 64 } 65 66 BOOST_LOG_CLOSE_NAMESPACE // namespace log 67 68 } // namespace boost 69 70 #include <boost/log/detail/footer.hpp> 71 72 #endif // BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ 73