Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-04-08 22:17:36


> Hello Fellow Boosters,
>
> I'd like to propose the design and development of a logging library
> to be included in boost.
>
> I've been thinking about what boost lacks, and this is one area of utility
> that I think would benefit the boost community.

This would be a good idea. Every reasonable size project builds logging infrastructure. I'm
personally tired of reinventing this wheel...

> Some basic requirements:
> - Some basic sink types (file, console, ring buffer...)
> - Ability to log based on levels
> - Ability to turn logging on/off dynamically
> - Focus should be on good performance, and usability of the API. Make it
> easy to setup and use logs.
> - Useful, built in format specifiers.
> - As fast a possible.
> - Parameterizeable thread safety. Don't penalize programs that do not need
> thread
> safe logs.

Some other clever things I have seen:
-- system portability / integration
   That is write to Syslog on Unix or Windows Event logs on Windows
-- a log stream buffer that automatically timestamped all entries
-- tracing primitives for function begin/exit tracking (including exception exits)
   In user code you write something like:
   ENTRY("myfunction");

   RETURN("myfunction");

   Under the hood ENTRY creates a sentinel object. The sentinel object has a
   state which is set to "Exception Return". The RETURN macro updates the state
   to "Normal Return". If an exception is thrown the destructor of the sentinel
   writes "Exceptional Return" into the log.

-- a null log stream class that has all empty functions. This can be used
   with a logging policy parameter to compile out all logging in Release builds for
   performance critical code.

> Is there any interest in such a library.

Yes and I can contribute the null log stream class if people are interested.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk