Boost.Test > Components > The Unit Test Framework > Components > The Test Log
Boost Test logo

The Test Log

Definition

defined in unit_test_log.hpp

Synopsis
enum log_level {
    log_successful_tests     = 0,
    log_test_suites          = 1,
    log_messages             = 2,
    log_warnings             = 3,
    log_all_errors           = 4, // reported by unit test macros
    log_cpp_exception_errors = 5, // uncaught C++ exceptions
    log_system_errors        = 6, // including timeouts, signals, traps
    log_fatal_errors         = 7, // including unit test macros or
                                  // fatal system errors
    log_progress_only        = 8, // only unit test progress to be reported
    log_nothing              = 9
};


class unit_test_log
{
    static unit_test_log& instance();
    void                  set_log_stream( std::ostream& str );
    void                  set_log_threshold_level( log_level lev );
    void                  set_log_format( std::string const& log_format );
    void                  set_log_formatter( unit_test_log_formatter* the_formatter );
};
Description

To manage the testing output stream the Unit Test Framework uses a singleton class unit_test_log. This class is responsible for managing and formatting testing log. There two formats supported for testing log: human readable format and XML format. In most cases you do not need to use this class interface directly. The framework provides a simple way to set the log level and log format from outside of the test program. For more details and for the list of acceptable values see the Framework parameters.

Construction

There is only one instance if this class automatically created by the framework at test startup. To access it use method unit_test_log::instance().