14 #define BOOST_TEST_MODULE real_time_logger 16 #if BOOST_VERSION >= 105900 17 #include <boost/test/tools/output_test_stream.hpp> 19 #include <boost/test/output_test_stream.hpp> 21 #include <boost/date_time/posix_time/posix_time.hpp> 22 #include <boost/test/unit_test.hpp> 23 #include <boost/thread/thread.hpp> 30 for (
int i = 0; i < 9; ++i) rtl.
front() <<
"Call number " << i <<
'\n';
31 BOOST_CHECK(rtl.
full());
32 rtl.
front() <<
"This call should not appear in the output" <<
'\n';
35 BOOST_CHECK(!rtl.
full());
36 rtl.
front() <<
"This call should appear in the output" <<
'\n';
42 BOOST_CHECK_EQUAL(spinNb, 9);
44 rtl.
front() <<
"This msg should be short." <<
'\n';
55 struct sched_param threadParam;
56 if (pthread_getschedparam(pthread_self(), &threadPolicy, &threadParam) == 0) {
57 threadPolicy = SCHED_RR;
58 threadParam.sched_priority = 50;
59 pthread_setschedparam(pthread_self(), threadPolicy, &threadParam);
66 dgRTLOG() <<
"Call number " << i <<
'\n';
67 for (std::size_t i = 0; i < 12; ++i) {
68 boost::this_thread::sleep(boost::posix_time::milliseconds(20));
69 dgRTLOG() <<
"Call number " << i << std::endl;
70 BOOST_CHECK(!rtl.
full());
73 dgRTLOG() <<
"This call should appear in the output" <<
'\n';
#define dgADD_OSTREAM_TO_RTLOG(ostr)
BOOST_AUTO_TEST_CASE(monothread)
std::size_t getBufferSize()
boost::shared_ptr< LoggerStream > LoggerStreamPtr_t
Main class of the real-time logger.
void addOutputStream(const LoggerStreamPtr_t &os)
static RealTimeLogger & instance()