Win95 Log Files (I) [by Shirak]
Snippet Posted Wednesday, August 12th @ 11:39:27 PM, by George Greer in the Utils dept.
Added Mar 26, 1997. Click the link below to read it or download it.

From: Robert Baumstark <cst0656@nait.ab.ca>
Subject: Logging to file with Win95

After running under Win95 for a while,I got tired of not having any of
The log files saved to disk, so I came up with a very simple way to fix
it. However, by doing this, the logs will no longer come up on the screen,
so you have to hope all is going well.

Here's how it can be done:
 -------------
 In comm.c
 -------------
 search for:

  int port;
  char buf[512];
  int pos = 1;
  char *dir;
 and add:

  FILE *logfile;

 go down a couple lines, after the port and dir assignments, and add:

  if((logfile=freopen("LOGFILE.LOG", "a", stderr))==NULL)
    fprintf(stderr, "Error redirecting stderr, log files will not be saved\n");
  fprintf(stderr, "\n\n");

 This will simply redirect all of the logs from the screen, to a file called
logfile.log
 At the end of main, you have to add:

  fclose(logfile);

 Then in utils.c, you might have to make a couple of changes, I forget if i
made them,  or if they were already there, but in the log, and mudlog
functions, make sure they    say:

  fprintf(stderr, ....);

 That way, all logs that would normally be written on the screen will be
redirected to   the logfile.log on your disk.  On my machine, during the
testing stages, It saved this  file to the /lib directory, but now that the
mud is up on my friends server, the log is  saved into the root circle
directory, so if you use this, just look around, it'll be  there.  If you
can't find it, try "dir logfile.log /s" from c:\, and it will find it,  if
it exists.

Shirak


<< Who level sorting (QSort) [by Jorgen Sigvardsson] | Reply | View as text | Flattened | Win95 Log Files (II) [by Andy Hubbard] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.