[CODE] More on SYSERR: Using log() before stream was initialized!

From: QA Developer (developer@csgmail.artisoft.com)
Date: 05/25/99


Through monitoring I found that something was calling log and logfile had
not been initialized yet.

I still don't know why though.

I would like to know:
1. What would call log before logfile is initialized
2. How can I init logfile earlier
3. why void basic_mud_log(const char *format, ...)  has the ,... at the
descriptions.
  why does it work?

Thanks

I modified the routine as follows and the mud continues on: (added a return
on the syserror)

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

  if (logfile == NULL)
  {
    puts("SYSERR: Using log() before stream was initialized!");
        return;
  }
  if (format == NULL)
  {
    format = "SYSERR: log() received a NULL format.";
        return;
  }

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

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

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

  fprintf(logfile, "\n");
  fflush(logfile);
}

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



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