[MUD-Dev] Technical programming question (circular buffers & logging)

Ben Greear greear at cyberhighway.net
Wed Jul 14 18:53:31 CEST 1999


Well, through no fault of my own *grin* a nasty bug has entered
my code!  It seems to be a memory corruption bug, as all good ones
are.

So, I turned on my verbose logging and after about 10 minutes I have a 15MB file.

(The trouble spot is called *very* often.)

So, what I want to do is modify my logging class (basically just
an ofstream with some flags tacked on it).  I was thinking about
making it a sort of ring-buffer where it just kept the last 50k
or some other nice round number.

This would be nice because I could turn logging on a really
verbose level, and not fill up my HD.  Usually I only want
the last little bit of the log anyway.

I think I could write my own thing to do this, but I was wondering
if anyone knew of any tricks with files, or ready-built libraries
to do something like this...

Oh, one final thing:  If I keep it all in memory, I will want to
(at least) catch the SIGSEGV can flush it to disk at that time.
Does anyone forsee any problems with this??

Thanks a heap,
Ben


--
Ben Greear (greear at cyberhighway.net)  http://scry.wanfear.com/~greear 
Author of ScryMUD:  scry.wanfear.com 4444        (Released under GPL)
http://scry.wanfear.com


_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev




More information about the mud-dev-archive mailing list