Boost logo

Boost Users :

Subject: [Boost-users] Boost::Test and streams
From: Jeffrey Walton (noloader_at_[hidden])
Date: 2011-08-08 07:59:07


Hi All,

I'm working form
http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html.

I can't seem to find Boost::Test's streams. The discussion of streams
begins at [1]. [1] does list macros such as
BOOST_TEST_DONT_PRINT_LOG_VALUE, but I'm interested in a C++-centric
solution. For example:

  // test framework output stream
  using boost_test::tout;

  tout << loglevel::error << "My error message" << endl;
  tout << loglevel::warn << "My warning message" << endl;

According to [2], I can set the log level from the environment and
from the command line. But would like to set it dynamically. For
example:

  tout << setlevel(warn); // warnings and above
    or
  tout.setlelvel(error); // errors and above

In addition, I would like to be able to tie a file output to screen
output, so I can watch the tests roll by and go to the log file for in
depth reading. To be fair, redirection is covered at [3], but its not
quite what we are looking for. For example:

  ofstream logfile(...);
  ...

  tout.attach(logfile);
    or
  tout.tie(logfile);

Though the authors did a great job on the documentation, these topics
do not appear to be included. Any ideas how one might go about these
sorts of things?

Thanks in advance,
Jeffrey Walton

[1] http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/utf/user-guide/test-output.html
[2] http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/utf/user-guide/runtime-config/reference.html
[3] http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/utf/user-guide/test-output/log-ct-config.html


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net