Add an alternative paniclog format as compile-time option
This commit is contained in:
@@ -206,6 +206,10 @@
|
|||||||
#define NEWS "news" /* the file containing the latest hack news */
|
#define NEWS "news" /* the file containing the latest hack news */
|
||||||
#define PANICLOG "paniclog" /* log of panic and impossible events */
|
#define PANICLOG "paniclog" /* log of panic and impossible events */
|
||||||
|
|
||||||
|
/* alternative paniclog format, better suited for public servers with
|
||||||
|
many players, as it saves the player name and the game start time */
|
||||||
|
/* #define PANICLOG_FMT2 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PERSMAX, POINTSMIN, ENTRYMAX, PERS_IS_UID:
|
* PERSMAX, POINTSMIN, ENTRYMAX, PERS_IS_UID:
|
||||||
* These control the contents of 'record', the high-scores file.
|
* These control the contents of 'record', the high-scores file.
|
||||||
|
|||||||
@@ -3120,6 +3120,11 @@ const char *reason; /* explanation */
|
|||||||
program_state.in_paniclog = 1;
|
program_state.in_paniclog = 1;
|
||||||
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
||||||
if (lfile) {
|
if (lfile) {
|
||||||
|
#ifdef PANICLOG_FMT2
|
||||||
|
(void) fprintf(lfile, "%ld %s: %s %s\n",
|
||||||
|
ubirthday, (plname ? plname : "(none)"),
|
||||||
|
type, reason);
|
||||||
|
#else
|
||||||
time_t now = getnow();
|
time_t now = getnow();
|
||||||
int uid = getuid();
|
int uid = getuid();
|
||||||
char playmode = wizard ? 'D' : discover ? 'X' : '-';
|
char playmode = wizard ? 'D' : discover ? 'X' : '-';
|
||||||
@@ -3127,6 +3132,7 @@ const char *reason; /* explanation */
|
|||||||
(void) fprintf(lfile, "%s %08ld %06ld %d %c: %s %s\n",
|
(void) fprintf(lfile, "%s %08ld %06ld %d %c: %s %s\n",
|
||||||
version_string(buf), yyyymmdd(now), hhmmss(now),
|
version_string(buf), yyyymmdd(now), hhmmss(now),
|
||||||
uid, playmode, type, reason);
|
uid, playmode, type, reason);
|
||||||
|
#endif /* !PANICLOG_FMT2 */
|
||||||
(void) fclose(lfile);
|
(void) fclose(lfile);
|
||||||
}
|
}
|
||||||
program_state.in_paniclog = 0;
|
program_state.in_paniclog = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user