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)
8 * \file current_process_name.hpp
9 * \author Andrey Semashev
12 * The header contains implementation of a current process name attribute
15 #ifndef BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
16 #define BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/attributes/constant.hpp>
21 #include <boost/log/attributes/attribute_cast.hpp>
22 #include <boost/log/detail/header.hpp>
24 #ifdef BOOST_HAS_PRAGMA_ONCE
30 BOOST_LOG_OPEN_NAMESPACE
34 //! The function returns the current process name
35 BOOST_LOG_API std::string get_process_name();
39 namespace attributes {
42 * \brief A class of an attribute that holds the current process name
44 class current_process_name :
45 public constant< std::string >
47 typedef constant< std::string > base_type;
51 * Constructor. Initializes the attribute with the current process name.
53 current_process_name() : base_type(boost::log::aux::get_process_name()) {}
55 * Constructor for casting support
57 explicit current_process_name(cast_source const& source) :
63 } // namespace attributes
65 BOOST_LOG_CLOSE_NAMESPACE // namespace log
69 #include <boost/log/detail/footer.hpp>
71 #endif // BOOST_LOG_ATTRIBUTES_CURRENT_PROCESS_NAME_HPP_INCLUDED_