the panic log
Add an optional paniclog file, controlled by a new PANICLOG macro that can be used to log all panic and impossible messages. Helpful when people forget to send, or didn't see, the message.
This commit is contained in:
@@ -294,6 +294,7 @@ panic VA_DECL(const char *, str)
|
||||
char buf[BUFSZ];
|
||||
Vsprintf(buf,str,VA_ARGS);
|
||||
raw_print(buf);
|
||||
paniclog("panic", buf);
|
||||
}
|
||||
#if defined(WIZARD) && (defined(UNIX) || defined(VMS) || defined(LATTICE) || defined(WIN32))
|
||||
if (wizard)
|
||||
|
||||
22
src/files.c
22
src/files.c
@@ -1782,4 +1782,26 @@ const char *dir;
|
||||
|
||||
/* ---------- END SCOREBOARD CREATION ----------- */
|
||||
|
||||
/* ---------- BEGIN PANIC/IMPOSSIBLE LOG ----------- */
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
paniclog(why, s)
|
||||
const char* why;
|
||||
const char* s;
|
||||
{
|
||||
#ifdef PANICLOG
|
||||
FILE *lfile;
|
||||
|
||||
lfile = fopen_datafile(PANICLOG, "a", TRUE);
|
||||
if (lfile) {
|
||||
(void) fprintf(lfile, "%08ld: %s %s\n",
|
||||
yyyymmdd((time_t)0L), why, s);
|
||||
(void) fclose(lfile);
|
||||
}
|
||||
#endif /* PANICLOG */
|
||||
}
|
||||
|
||||
/* ---------- END PANIC/IMPOSSIBLE LOG ----------- */
|
||||
|
||||
/*files.c*/
|
||||
|
||||
@@ -248,6 +248,11 @@ void
|
||||
impossible VA_DECL(const char *, s)
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
{
|
||||
char pbuf[BUFSZ];
|
||||
Vsprintf(pbuf,s,VA_ARGS);
|
||||
paniclog("impossible", s);
|
||||
}
|
||||
vpline(s,VA_ARGS);
|
||||
pline("Program in disorder - perhaps you'd better #quit.");
|
||||
VA_END();
|
||||
|
||||
Reference in New Issue
Block a user