]> jfr.im git - irc/quakenet/newserv.git/blame - core/error.h
BUILD: add require-all build mode
[irc/quakenet/newserv.git] / core / error.h
CommitLineData
550b82a2 1#ifndef __ERROR_H
2#define __ERROR_H
3
2c5db955
CP
4/* error.h:
5 *
6 * Error flagging routines
7 */
8
9e920a41 9/* SEVERITY GUIDELINES:
10 *
11 * ERR_STOP: Something so bad has happened that the whole service must
12 * stop. Something like a malloc() error or similar magnitude
13 * error.
14 *
15 * ERR_FATAL: Something so bad has happened that the module cannot usefully
16 * function any more, but won't necessarily prevent other modules
17 * from working.
18 *
19 * ERR_ERROR: Something is wrong, perhaps a data structure is inconsistent
20 * or something similar has gone wrong internally. This might
21 * indicate a larger problem but the module can continue working
22 * for now.
23 *
24 * ERR_WARNING: Something slightly out of the ordinary has happened (e.g.
25 * the IRCD sent a bogus message). The module can continue
26 * working though without serious harm.
27 *
28 * ERR_INFO: Not an error condition. Something noteworthy has happened,
29 * like a major module has started up. These will typically be
30 * seen all the time on most setups so try not to be too spammy.
31 *
32 * ERR_DEBUG: Not an error condition. Something less significant has
33 * happened which might be of interest if someone is attempting
34 * to debug a problem. Nevertheless try not to be too spammy.
35 */
2c5db955
CP
36
37#define ERR_DEBUG 0
38#define ERR_INFO 1
39#define ERR_WARNING 2
40#define ERR_ERROR 3
41#define ERR_FATAL 4
b71fee1d 42#define ERR_STOP 5
2c5db955 43
280505a5 44struct error_event {
45 int severity;
46 char *message;
4011a4ee 47 char *source;
280505a5 48};
49
cdc37146
CP
50typedef void (*CoreHandlerFn)(void *arg);
51
52typedef struct corehandler {
53 void *arg;
54 CoreHandlerFn fn;
55 struct corehandler *prev, *next;
56} corehandler;
57
bb4b25ee 58void Error(char *source, int severity, char *reason, ... ) __attribute__ ((format (printf, 3, 4)));
550b82a2 59
cdc37146
CP
60corehandler *registercorehandler(CoreHandlerFn fn, void *arg);
61void deregistercorehandler(corehandler *c);
62
550b82a2 63#endif