]>
jfr.im git - irc/quakenet/newserv.git/blob - core/error.c
12 char *sevtostring(int severity
) {
30 return "terminal error";
33 return "unknown error";
38 logfile
=fopen("newserv.log","a");
41 void Error(char *source
, int severity
, char *reason
, ... ) {
47 struct error_event evt
;
50 vsnprintf(buf
,512,reason
,va
);
53 evt
.severity
=severity
;
56 triggerhook(HOOK_CORE_ERROR
, &evt
);
58 if (severity
>ERR_DEBUG
) {
61 strftime(timebuf
,100,"%Y-%m-%d %H:%M:%S",tm
);
62 fprintf(stderr
,"[%s] %s(%s): %s\n",timebuf
,sevtostring(severity
),source
,buf
);
64 fprintf(logfile
,"[%s] %s(%s): %s\n",timebuf
,sevtostring(severity
),source
,buf
);
67 if (severity
>=ERR_STOP
) {
68 fprintf(stderr
,"Terminal error occured, exiting...\n");
69 triggerhook(HOOK_CORE_STOPERROR
, NULL
);