~ai.tron/armagetronad/0.4-winlibs-updated

« back to all changes in this revision

Viewing changes to boost/includes/boost/log/utility/setup/common_attributes.hpp

  • Committer: Nik K.
  • Date: 2013-11-07 16:58:35 UTC
  • Revision ID: nik.karbaum@gmail.com-20131107165835-kq99jz23drfj4dkh
Forgot to add some files; here they are

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *          Copyright Andrey Semashev 2007 - 2013.
 
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   common_attributes.hpp
 
9
 * \author Andrey Semashev
 
10
 * \date   16.05.2008
 
11
 *
 
12
 * The header contains implementation of convenience functions for registering commonly used attributes.
 
13
 */
 
14
 
 
15
#ifndef BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_
 
16
#define BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_
 
17
 
 
18
#include <iostream>
 
19
#include <boost/log/detail/config.hpp>
 
20
#include <boost/log/core/core.hpp>
 
21
#include <boost/log/attributes/clock.hpp>
 
22
#include <boost/log/attributes/counter.hpp>
 
23
#include <boost/log/attributes/current_process_id.hpp>
 
24
#if !defined(BOOST_LOG_NO_THREADS)
 
25
#include <boost/log/attributes/current_thread_id.hpp>
 
26
#endif
 
27
#include <boost/log/detail/default_attribute_names.hpp>
 
28
#include <boost/log/detail/header.hpp>
 
29
 
 
30
#ifdef BOOST_LOG_HAS_PRAGMA_ONCE
 
31
#pragma once
 
32
#endif
 
33
 
 
34
namespace boost {
 
35
 
 
36
BOOST_LOG_OPEN_NAMESPACE
 
37
 
 
38
/*!
 
39
 * \brief Simple attribute initialization routine
 
40
 *
 
41
 * The function adds commonly used attributes to the logging system. Specifically, the following
 
42
 * attributes are registered globally:
 
43
 *
 
44
 * \li LineID - logging records counter with value type <tt>unsigned int</tt>
 
45
 * \li TimeStamp - local time generator with value type <tt>boost::posix_time::ptime</tt>
 
46
 * \li ProcessID - current process identifier with value type
 
47
 *     <tt>attributes::current_process_id::value_type</tt>
 
48
 * \li ThreadID - in multithreaded builds, current thread identifier with
 
49
 *     value type <tt>attributes::current_thread_id::value_type</tt>
 
50
 */
 
51
inline void add_common_attributes()
 
52
{
 
53
    shared_ptr< core > pCore = core::get();
 
54
    pCore->add_global_attribute(
 
55
        aux::default_attribute_names::line_id(),
 
56
        attributes::counter< unsigned int >(1));
 
57
    pCore->add_global_attribute(
 
58
        aux::default_attribute_names::timestamp(),
 
59
        attributes::local_clock());
 
60
    pCore->add_global_attribute(
 
61
        aux::default_attribute_names::process_id(),
 
62
        attributes::current_process_id());
 
63
#if !defined(BOOST_LOG_NO_THREADS)
 
64
    pCore->add_global_attribute(
 
65
        aux::default_attribute_names::thread_id(),
 
66
        attributes::current_thread_id());
 
67
#endif
 
68
}
 
69
 
 
70
BOOST_LOG_CLOSE_NAMESPACE // namespace log
 
71
 
 
72
} // namespace boost
 
73
 
 
74
#include <boost/log/detail/footer.hpp>
 
75
 
 
76
#endif // BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_