annotate DEPENDENCIES/generic/include/boost/log/utility/setup/common_attributes.hpp @ 133:4acb5d8d80b6 tip

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