RE: Logging library - your own scenario! (John Torjo)

Most of our scenario has been covered by other posts, i.e. configurable levels of logging, configurable destinations - including an in-memory cyclic buffer (sometimes the only way to catch fatal bugs on a system without an ICE or core dump), etc. One thing that I would really like to have that hasn't been mentioned before is the ability to configure how char types (including signed and unsigned) are logged. A lot of our work is low level network related and logging messages is important. For this we almost always use char types to contain numbers, but of course any use of stream inserters will treat them as characters, something that can ruin a complete log (if serialised as text). Although it could be said to be our responsibility to ensure that any data logged via a stream inserter is formatted correctly sometimes it is easy to forget. The ability to configure the logging library to specify how types are formatted in the log would be extremely useful (and probably not just for this scenario). The cppunit library allows the format of types output to be configured by introducing a specialisation of a traits class which would be useful. It could look something like: template<> struct log_traits<unsigned char> { static std::string toString( const unsigned char& x ) { std::ostringstream ost; ost << static_cast<unsigned int>(x); return ost.str(); } }; I have not yet had time to look at your library so if this feature is already included then please accept my apologies - but count it as a vote for its retention :-) Graham Shanks ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ********************************************************************
participants (1)
-
Shanks, Graham