summaryrefslogtreecommitdiff
path: root/libs/log/src/default_attribute_names.cpp
blob: 9bd3cbe14d1865f65d324a5306f8f6f1df0da6d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 *          Copyright Andrey Semashev 2007 - 2015.
 * Distributed under the Boost Software License, Version 1.0.
 *    (See accompanying file LICENSE_1_0.txt or copy at
 *          http://www.boost.org/LICENSE_1_0.txt)
 */
/*!
 * \file   default_attribute_names.cpp
 * \author Andrey Semashev
 * \date   13.07.2012
 *
 * \brief  This header is the Boost.Log library implementation, see the library documentation
 *         at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
 */

#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/log/detail/default_attribute_names.hpp>
#include <boost/log/detail/singleton.hpp>
#include <boost/log/detail/header.hpp>

namespace boost {

BOOST_LOG_OPEN_NAMESPACE

namespace aux {

namespace default_attribute_names {

BOOST_LOG_ANONYMOUS_NAMESPACE {

    class names :
        public lazy_singleton< names, shared_ptr< names > >
    {
    private:
        typedef lazy_singleton< names, shared_ptr< names > > base_type;

#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS)
        friend class lazy_singleton< names, shared_ptr< names > >;
#else
        friend class base_type;
#endif

    public:
        const attribute_name severity;
        const attribute_name channel;
        const attribute_name message;
        const attribute_name line_id;
        const attribute_name timestamp;
        const attribute_name process_id;
        const attribute_name thread_id;

    private:
        names() :
            severity("Severity"),
            channel("Channel"),
            message("Message"),
            line_id("LineID"),
            timestamp("TimeStamp"),
            process_id("ProcessID"),
            thread_id("ThreadID")
        {
        }

        static void init_instance()
        {
            get_instance().reset(new names());
        }

    public:
        static names& get()
        {
            return *base_type::get();
        }
    };

} // namespace

BOOST_LOG_API attribute_name severity()
{
    return names::get().severity;
}

BOOST_LOG_API attribute_name channel()
{
    return names::get().channel;
}

BOOST_LOG_API attribute_name message()
{
    return names::get().message;
}

BOOST_LOG_API attribute_name line_id()
{
    return names::get().line_id;
}

BOOST_LOG_API attribute_name timestamp()
{
    return names::get().timestamp;
}

BOOST_LOG_API attribute_name process_id()
{
    return names::get().process_id;
}

BOOST_LOG_API attribute_name thread_id()
{
    return names::get().thread_id;
}

} // namespace default_attribute_names

} // namespace aux

BOOST_LOG_CLOSE_NAMESPACE // namespace log

} // namespace boost

#include <boost/log/detail/footer.hpp>