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 default_attribute_names.cpp
9 * \author Andrey Semashev
10 * \date 13.07.2012
11 *
12 * \brief This header is the Boost.Log library implementation, see the library documentation
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
14 */
15
16#include <boost/log/detail/config.hpp>
17#include <boost/smart_ptr/shared_ptr.hpp>
18#include <boost/log/detail/default_attribute_names.hpp>
19#include <boost/log/detail/singleton.hpp>
20#include <boost/log/detail/header.hpp>
21
22namespace boost {
23
24BOOST_LOG_OPEN_NAMESPACE
25
26namespace aux {
27
28namespace default_attribute_names {
29
30BOOST_LOG_ANONYMOUS_NAMESPACE {
31
32 class names :
33 public lazy_singleton< names, shared_ptr< names > >
34 {
35 private:
36 typedef lazy_singleton< names, shared_ptr< names > > base_type;
37
38#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS)
39 friend class lazy_singleton< names, shared_ptr< names > >;
40#else
41 friend class base_type;
42#endif
43
44 public:
45 const attribute_name severity;
46 const attribute_name channel;
47 const attribute_name message;
48 const attribute_name line_id;
49 const attribute_name timestamp;
50 const attribute_name process_id;
51 const attribute_name thread_id;
52
53 private:
54 names() :
55 severity("Severity"),
56 channel("Channel"),
57 message("Message"),
58 line_id("LineID"),
59 timestamp("TimeStamp"),
60 process_id("ProcessID"),
61 thread_id("ThreadID")
62 {
63 }
64
65 static void init_instance()
66 {
67 get_instance().reset(p: new names());
68 }
69
70 public:
71 static names& get()
72 {
73 return *base_type::get();
74 }
75 };
76
77} // namespace
78
79BOOST_LOG_API attribute_name severity()
80{
81 return names::get().severity;
82}
83
84BOOST_LOG_API attribute_name channel()
85{
86 return names::get().channel;
87}
88
89BOOST_LOG_API attribute_name message()
90{
91 return names::get().message;
92}
93
94BOOST_LOG_API attribute_name line_id()
95{
96 return names::get().line_id;
97}
98
99BOOST_LOG_API attribute_name timestamp()
100{
101 return names::get().timestamp;
102}
103
104BOOST_LOG_API attribute_name process_id()
105{
106 return names::get().process_id;
107}
108
109BOOST_LOG_API attribute_name thread_id()
110{
111 return names::get().thread_id;
112}
113
114} // namespace default_attribute_names
115
116} // namespace aux
117
118BOOST_LOG_CLOSE_NAMESPACE // namespace log
119
120} // namespace boost
121
122#include <boost/log/detail/footer.hpp>
123

source code of boost/libs/log/src/default_attribute_names.cpp