[Cppunit-devel] Logging.
Brought to you by:
blep
From: John C. <joh...@ta...> - 2002-01-21 21:36:23
|
While I'm on the subject, I feel that there should be a logging class. I often 'cout << ' things as I go a long, which mucks up the pretty ...'s Yes, I know UnitTest's are automagic things that happen in the dark of the night and know one should ever need to look at the logs. But when the nifty automagic unit test fails, one can often immediately see why if there was a nifty log file somewhere, and hence debug the problem faster. There should be a nifty way of recording things as the test goes along.... Something like.... DEBUG( "My pretty log message " << myObject.ToString()); which results in... Some meaningful and informative header giving run date, build date, and hopefully useful CVS $Tag$ info. filename.c:120:[MyClass::MyFunction] My pretty log message Pretty Object Where DEBUG is a mix of preprocessor and a invocation of a logging utility.... #define DEBUG(msg) do {\ CppUnit::Log::Instance()->PrintHeader(__FILE__,__LINE__,__PRETTY_FUNCTION__) \ << msg << endl; \ } while(0) I'm planning on doing something like that, I have most of the code lying around anyway. What would be the best way of doing it in a manner most likely to gain your acceptance? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : joh...@ta... New Zealand Zeitgeist shutting down for corrective maintenance, please log off. |