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