Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file common_attributes.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 16.05.2008 Chris@16: * Chris@16: * The header contains implementation of convenience functions for registering commonly used attributes. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #if !defined(BOOST_LOG_NO_THREADS) Chris@16: #include Chris@16: #endif Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: /*! Chris@16: * \brief Simple attribute initialization routine Chris@16: * Chris@16: * The function adds commonly used attributes to the logging system. Specifically, the following Chris@16: * attributes are registered globally: Chris@16: * Chris@16: * \li LineID - logging records counter with value type unsigned int Chris@16: * \li TimeStamp - local time generator with value type boost::posix_time::ptime Chris@16: * \li ProcessID - current process identifier with value type Chris@16: * attributes::current_process_id::value_type Chris@16: * \li ThreadID - in multithreaded builds, current thread identifier with Chris@16: * value type attributes::current_thread_id::value_type Chris@16: */ Chris@16: inline void add_common_attributes() Chris@16: { Chris@16: shared_ptr< core > pCore = core::get(); Chris@16: pCore->add_global_attribute( Chris@16: aux::default_attribute_names::line_id(), Chris@16: attributes::counter< unsigned int >(1)); Chris@16: pCore->add_global_attribute( Chris@16: aux::default_attribute_names::timestamp(), Chris@16: attributes::local_clock()); Chris@16: pCore->add_global_attribute( Chris@16: aux::default_attribute_names::process_id(), Chris@16: attributes::current_process_id()); Chris@16: #if !defined(BOOST_LOG_NO_THREADS) Chris@16: pCore->add_global_attribute( Chris@16: aux::default_attribute_names::thread_id(), Chris@16: attributes::current_thread_id()); Chris@16: #endif Chris@16: } Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_LOG_UTILITY_SETUP_COMMON_ATTRIBUTES_HPP_INCLUDED_