Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / include / ircd_log.h
1 /* - Internet Relay Chat, include/ircd_log.h
2  *   Copyright (C) 1999 Thomas Helvey
3  *
4  *   This program is free software; you can redistribute it and/or modify
5  *   it under the terms of the GNU General Public License as published by
6  *   the Free Software Foundation; either version 1, or (at your option)
7  *   any later version.
8  *
9  *   This program is distributed in the hope that it will be useful,
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *   GNU General Public License for more details.
13  *
14  *   You should have received a copy of the GNU General Public License
15  *   along with this program; if not, write to the Free Software
16  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  *
19  * $Id$
20  */
21 #ifndef INCLUDED_ircd_log_h
22 #define INCLUDED_ircd_log_h
23
24 #ifndef INCLUDED_stdarg_h
25 #include <stdarg.h>         /* va_list */
26 #define INCLUDED_stdarg_h
27 #endif
28
29 struct Client;
30
31 /* WARNING WARNING WARNING -- Order is important; these enums are
32  * used as indexes into arrays.
33  */
34
35 enum LogLevel {
36   L_CRIT,
37   L_ERROR,
38   L_WARNING,
39   L_NOTICE,
40   L_TRACE,
41   L_INFO,
42   L_DEBUG,
43   L_LAST_LEVEL
44 };
45
46 enum LogSys {
47   LS_SYSTEM, LS_CONFIG, LS_OPERMODE, LS_GLINE, LS_JUPE, LS_WHO, LS_NETWORK,
48   LS_OPERKILL, LS_SERVKILL, LS_OPER, LS_OPERLOG, LS_USERLOG, LS_RESOLVER,
49   LS_SOCKET, LS_DEBUG, LS_OLDLOG,
50   LS_LAST_SYSTEM
51 };
52
53 extern void open_log(const char* process_name);
54 extern void close_log(void);
55 extern void set_log_level(int level);
56 extern int  get_log_level(void);
57 extern void ircd_log(int priority, const char* fmt, ...);
58
59 extern void ircd_log_kill(const struct Client* victim,
60                           const struct Client* killer,
61                           const char*          inpath,
62                           const char*          path);
63
64 extern void log_debug_init(char *file);
65 extern void log_init(const char *process_name);
66 extern void log_reopen(void);
67 extern void log_close(void);
68
69 extern void log_write(enum LogSys subsys, enum LogLevel severity,
70                       unsigned int flags, const char *fmt, ...);
71 extern void log_vwrite(enum LogSys subsys, enum LogLevel severity,
72                        unsigned int flags, const char *fmt, va_list vl);
73
74 extern void log_write_kill(const struct Client *victim,
75                            const struct Client *killer,
76                            const char          *inpath,
77                            const char          *path);
78
79 #define LOG_NOSYSLOG    0x01
80 #define LOG_NOFILELOG   0x02
81 #define LOG_NOSNOTICE   0x04
82
83 #define LOG_NOMASK      (LOG_NOSYSLOG | LOG_NOFILELOG | LOG_NOSNOTICE)
84
85 extern char *log_canon(const char *subsys);
86
87 extern int log_set_file(const char *subsys, const char *filename);
88 extern char *log_get_file(const char *subsys);
89
90 extern int log_set_facility(const char *subsys, const char *facility);
91 extern char *log_get_facility(const char *subsys);
92
93 extern int log_set_snomask(const char *subsys, const char *facility);
94 extern char *log_get_snomask(const char *subsys);
95
96 extern int log_set_level(const char *subsys, const char *level);
97 extern char *log_get_level(const char *subsys);
98
99 extern int log_set_default(const char *facility);
100 extern char *log_get_default(void);
101
102 extern void log_feature_report(struct Client *to);
103
104 #endif /* INCLUDED_ircd_log_h */