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 event_log_constants.hpp 9 * \author Andrey Semashev 10 * \date 07.11.2008 11 * 12 * The header contains definition of constants related to Windows NT Event Log API. 13 * The constants can be used in other places without the event log backend. 14 */ 15 16 #ifndef BOOST_LOG_SINKS_EVENT_LOG_CONSTANTS_HPP_INCLUDED_ 17 #define BOOST_LOG_SINKS_EVENT_LOG_CONSTANTS_HPP_INCLUDED_ 18 19 #include <boost/log/detail/config.hpp> 20 21 #ifdef BOOST_HAS_PRAGMA_ONCE 22 #pragma once 23 #endif 24 25 #ifndef BOOST_LOG_WITHOUT_EVENT_LOG 26 27 #include <boost/log/detail/tagged_integer.hpp> 28 #include <boost/log/detail/header.hpp> 29 30 namespace boost { 31 32 BOOST_LOG_OPEN_NAMESPACE 33 34 namespace sinks { 35 36 namespace event_log { 37 38 struct event_id_tag; 39 //! A tagged integral type that represents event identifier for the Windows API 40 typedef boost::log::aux::tagged_integer< unsigned int, event_id_tag > event_id; 41 /*! 42 * The function constructs event identifier from an integer 43 */ make_event_id(unsigned int id)44 inline event_id make_event_id(unsigned int id) 45 { 46 event_id iden = { id }; 47 return iden; 48 } 49 50 struct event_category_tag; 51 //! A tagged integral type that represents event category for the Windows API 52 typedef boost::log::aux::tagged_integer< unsigned short, event_category_tag > event_category; 53 /*! 54 * The function constructs event category from an integer 55 */ make_event_category(unsigned short cat)56 inline event_category make_event_category(unsigned short cat) 57 { 58 event_category category = { cat }; 59 return category; 60 } 61 62 //! Windows event types 63 enum event_type 64 { 65 success = 0, //!< Equivalent to EVENTLOG_SUCCESS 66 info = 4, //!< Equivalent to EVENTLOG_INFORMATION_TYPE 67 warning = 2, //!< Equivalent to EVENTLOG_WARNING_TYPE 68 error = 1 //!< Equivalent to EVENTLOG_ERROR_TYPE 69 }; 70 71 /*! 72 * The function constructs log record level from an integer 73 */ 74 BOOST_LOG_API event_type make_event_type(unsigned short lev); 75 76 } // namespace event_log 77 78 } // namespace sinks 79 80 BOOST_LOG_CLOSE_NAMESPACE // namespace log 81 82 } // namespace boost 83 84 #include <boost/log/detail/footer.hpp> 85 86 #endif // BOOST_LOG_WITHOUT_EVENT_LOG 87 88 #endif // BOOST_LOG_SINKS_EVENT_LOG_CONSTANTS_HPP_INCLUDED_ 89