1999Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Technical programming question (circular buffers &#38; logging) -->
<!--X-From-R13: Quevf Uenl <ptNnzv&#45;pt.UenlEntr.Sqzbagba.OP.QO> -->
<!--X-Date: Thu, 15 Jul 1999 11:24:56 &#45;0700 -->
<!--X-Message-Id: 199907150435.WAA02423@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Technical programming question (circular buffers</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00910.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00912.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00914.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00922.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00911">Author</A>
&nbsp;|&nbsp;<A HREF="#00911">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00911">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</LI>
<LI><em>From</em>: Chris Gray &lt;<A HREF="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</A>&gt;</LI>
<LI><em>Date</em>: Wed, 14 Jul 1999 22:35:53 -0600</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
[Ben Greear:]

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

I've used that technique both in my MUD and at work. It works pretty well.
Rather than getting complex and logging full text messages, however, we've
tended to just log simpler things. My MUD just logs a pointer to a text
message, and a single 32 bit value. If the system itself aborts, it
dumps the contents of the ring out - it deferences the string pointers
to get the actual text. I think there was an occasion at work where I
needed to look at the buffer in a core dump, and it was a bit clumsy,
but certainly doable.

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

Should work, as long as you rely on as little as possible in the dumping
code. E.g. open the logging file with a low level 'open' call, write
it out with no use of stdio, iostream, etc., then close it. That should
minimize the amount of code/data you depend on, and reduce the likelihood
of a nested SEGV.

--
Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg#ami-cg,GraySage.Edmonton.AB.CA
               <A  HREF="http://www.GraySage.Edmonton.AB.CA/cg/">http://www.GraySage.Edmonton.AB.CA/cg/</A>



_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00922" HREF="msg00922.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>
<ul compact><li><em>From:</em> Ben Greear &lt;greear#cyberhighway,net&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00910.html">[MUD-Dev] pfiles</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00912.html">Re: [MUD-Dev] an idea..wondering if this has been done</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00914.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00922.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00911"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00911"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] an idea..wondering if this has been done</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<LI><strong><A NAME="00929" HREF="msg00929.html">Re: [MUD-Dev] an idea..wondering if this has been done</A></strong>, 
Joey Hess <a href="mailto:joey#kitenet,net">joey#kitenet,net</a>, Sat 17 Jul 1999, 02:56 GMT
<UL>
<LI><strong><A NAME="00931" HREF="msg00931.html">Re: [MUD-Dev] an idea..wondering if this has been done</A></strong>, 
bruce <a href="mailto:bruce#puremagic,com">bruce#puremagic,com</a>, Mon 19 Jul 1999, 16:47 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
</LI>
<LI><strong><A NAME="00901" HREF="msg00901.html">[MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Thu 15 Jul 1999, 02:34 GMT
<UL>
<LI><strong><A NAME="00914" HREF="msg00914.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Greg Miller <a href="mailto:gmiller#classic-games,com">gmiller#classic-games,com</a>, Thu 15 Jul 1999, 22:05 GMT
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00911" HREF="msg00911.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 15 Jul 1999, 18:24 GMT
<UL>
<LI><strong><A NAME="00922" HREF="msg00922.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Fri 16 Jul 1999, 02:06 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00917" HREF="msg00917.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Fri 16 Jul 1999, 00:42 GMT
<UL>
<LI><strong><A NAME="00927" HREF="msg00927.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Greg Miller <a href="mailto:gmiller#classic-games,com">gmiller#classic-games,com</a>, Fri 16 Jul 1999, 19:05 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00926" HREF="msg00926.html">Re: [MUD-Dev] Technical programming question (circular buffers &amp; logging)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Fri 16 Jul 1999, 19:05 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>