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_USER, LS_OPER, LS_RESOLVER, LS_SOCKET,
49   LS_DEBUG, LS_OLDLOG,
50   LS_LAST_SYSTEM
51 };
52
53 extern void log_debug_init(int usetty);
54 extern void log_init(const char *process_name);
55 extern void log_reopen(void);
56 extern void log_close(void);
57
58 extern void log_write(enum LogSys subsys, enum LogLevel severity,
59                       unsigned int flags, const char *fmt, ...);
60 extern void log_vwrite(enum LogSys subsys, enum LogLevel severity,
61                        unsigned int flags, const char *fmt, va_list vl);
62
63 extern void log_write_kill(const struct Client *victim,
64                            const struct Client *killer,
65                            const char          *inpath,
66                            const char          *path,
67                            const char          *msg);
68
69 #define LOG_NOSYSLOG    0x01
70 #define LOG_NOFILELOG   0x02
71 #define LOG_NOSNOTICE   0x04
72
73 #define LOG_NOMASK      (LOG_NOSYSLOG | LOG_NOFILELOG | LOG_NOSNOTICE)
74
75 extern char *log_canon(const char *subsys);
76
77 extern int log_set_file(const char *subsys, const char *filename);
78 extern char *log_get_file(const char *subsys);
79
80 extern int log_set_facility(const char *subsys, const char *facility);
81 extern char *log_get_facility(const char *subsys);
82
83 extern int log_set_snomask(const char *subsys, const char *facility);
84 extern char *log_get_snomask(const char *subsys);
85
86 extern int log_set_level(const char *subsys, const char *level);
87 extern char *log_get_level(const char *subsys);
88
89 extern int log_set_default(const char *facility);
90 extern char *log_get_default(void);
91
92 extern void log_feature_unmark(void);
93 extern int log_feature_mark(int flag);
94 extern void log_feature_report(struct Client *to, int flag);
95
96 #endif /* INCLUDED_ircd_log_h */