src_logger_get_attributes.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  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)
  6. */
  7. /*!
  8. * \file src_logger_get_attributes.cpp
  9. * \author Andrey Semashev
  10. * \date 01.03.2014
  11. *
  12. * \brief This header contains a test for logger \c get_attributes method.
  13. */
  14. #include <boost/log/sources/logger.hpp>
  15. #include <boost/log/sources/severity_logger.hpp>
  16. #include <boost/log/sources/channel_logger.hpp>
  17. #include <boost/log/sources/severity_channel_logger.hpp>
  18. template< typename LoggerT >
  19. void test()
  20. {
  21. LoggerT lg;
  22. // Test that get_attributes(), which is a const method, can acquire the internal mutex in the threading model.
  23. lg.get_attributes();
  24. }
  25. int main(int, char*[])
  26. {
  27. test< boost::log::sources::logger >();
  28. test< boost::log::sources::severity_logger< > >();
  29. test< boost::log::sources::channel_logger< > >();
  30. test< boost::log::sources::severity_channel_logger< > >();
  31. #if !defined(BOOST_LOG_NO_THREADS)
  32. test< boost::log::sources::logger_mt >();
  33. test< boost::log::sources::severity_logger_mt< > >();
  34. test< boost::log::sources::channel_logger_mt< > >();
  35. test< boost::log::sources::severity_channel_logger_mt< > >();
  36. #endif
  37. return 0;
  38. }