Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2004-10-28 04:21:36

I'm finding an increasing need for an in-file memory log: specifically when
my program asserts I want to see where it has been.

There are two problems with normal logging, i.e. appending to a disk file:
   * The files get very, very big (I've filled my home partition before)
   * All that writing to disk slows the application down noticeably.

I checked log4cpp and John Torjo's logging library and neither seem to offer
this, but it seems it could fit as one of the logging targets. I had in mind
an object that is a wrapper for e.g. a 1Mb char buffer with the same
interface as std::ostream, so I can just write:
    log_buffer<<"In func1, x="<<x<<", obj="<<obj<<"\n";

And then when my program asserts I can pass log_buffer as a parameter to be
output (requires it to have operator<< defined):

Does anyone know of anything along these lines? Does anyone have the same
need, or just me? I found some circular buffers that nearly do what I want
[1] [2] [3], but they are lower-level as they don't offer the ostream
interface. (In my case I don't need thread-safety.)




[3]: Thread-safe circular queue, CUJ, June 2004.

Boost list run by bdawes at, gregod at, cpdaniel at, john at