compiler_log_formatter.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // (C) Copyright Gennadiy Rozental 2001.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. /// @file
  8. /// @brief Contains the formatter for the Human Readable Format (HRF)
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER
  11. #define BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER
  12. // Boost.Test
  13. #include <boost/test/detail/global_typedef.hpp>
  14. #include <boost/test/unit_test_log_formatter.hpp>
  15. #include <boost/test/utils/setcolor.hpp>
  16. #include <boost/test/detail/suppress_warnings.hpp>
  17. //____________________________________________________________________________//
  18. namespace boost {
  19. namespace unit_test {
  20. namespace output {
  21. // ************************************************************************** //
  22. // ************** compiler_log_formatter ************** //
  23. // ************************************************************************** //
  24. //!@brief Log formatter for the Human Readable Format (HRF) log format
  25. class BOOST_TEST_DECL compiler_log_formatter : public unit_test_log_formatter {
  26. public:
  27. compiler_log_formatter() : m_color_output( false ), m_color_state() {}
  28. // Formatter interface
  29. void log_start( std::ostream&, counter_t test_cases_amount ) BOOST_OVERRIDE;
  30. void log_finish( std::ostream& ) BOOST_OVERRIDE;
  31. void log_build_info( std::ostream&, bool ) BOOST_OVERRIDE;
  32. void test_unit_start( std::ostream&, test_unit const& tu ) BOOST_OVERRIDE;
  33. void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) BOOST_OVERRIDE;
  34. void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ) BOOST_OVERRIDE;
  35. void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ) BOOST_OVERRIDE;
  36. void log_exception_finish( std::ostream& ) BOOST_OVERRIDE;
  37. void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) BOOST_OVERRIDE;
  38. void log_entry_value( std::ostream&, const_string value ) BOOST_OVERRIDE;
  39. void log_entry_value( std::ostream&, lazy_ostream const& value ) BOOST_OVERRIDE;
  40. void log_entry_finish( std::ostream& ) BOOST_OVERRIDE;
  41. void entry_context_start( std::ostream&, log_level ) BOOST_OVERRIDE;
  42. void log_entry_context( std::ostream&, log_level l, const_string ) BOOST_OVERRIDE;
  43. void entry_context_finish( std::ostream&, log_level l ) BOOST_OVERRIDE;
  44. protected:
  45. virtual void print_prefix( std::ostream&, const_string file, std::size_t line );
  46. // Data members
  47. bool m_color_output;
  48. utils::setcolor::state m_color_state;
  49. };
  50. } // namespace output
  51. } // namespace unit_test
  52. } // namespace boost
  53. #include <boost/test/detail/enable_warnings.hpp>
  54. #endif // BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER