[WIN95] [NEWBIE] Logs

From: Douglas Mallory (dmallory@IXLMEMPHIS.COM)
Date: 07/13/98

In the course of starting up, I've run across the problem of logfiles.  I
post this because I found several unsatisfactory (outdated?) solutions.
What we poor Windows users want is visible log displays, AND file logs.  In
a nutshell, in config.c, set the define for a logfile.  Then in utils.c, in
basic_mud_log, duplicate each *print*(logfile,...) statement with an
identical statement, but change logfile to stdout.  We can't use stderr, as
that is what is redirected to logfile in the first place.  For precision,
here is what the edited log function should be:
If anyone sees any possible problem with this solution, please let me know.

void basic_mud_log(const char *format, ...)
  va_list args;
  time_t ct = time(0);
  char *time_s = asctime(localtime(&ct));

  time_s[strlen(time_s) - 1] = '\0';

  fprintf(logfile, "%-15.15s :: ", time_s + 4);
  fprintf(stdout, "%-15.15s :: ", time_s + 4);

  va_start(args, format);
  vfprintf(logfile, format, args);
  vfprintf(stdout, format, args);

  fprintf(logfile, "\n");
  fprintf(stdout, "\n");


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |

This archive was generated by hypermail 2b30 : 12/15/00 PST