1 /* - Internet Relay Chat, include/ircd_log.h
2 * Copyright (C) 1999 Thomas Helvey
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)
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.
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.
19 * @brief IRC logging interface.
22 #ifndef INCLUDED_ircd_log_h
23 #define INCLUDED_ircd_log_h
25 #ifndef INCLUDED_stdarg_h
26 #include <stdarg.h> /* va_list */
27 #define INCLUDED_stdarg_h
32 /* WARNING WARNING WARNING -- Order is important; these enums are
33 * used as indexes into arrays.
35 /** Level of a log message. */
37 L_CRIT, /**< Critical failure. */
38 L_ERROR, /**< Serious error. */
39 L_WARNING, /**< Recoverable warning. */
40 L_NOTICE, /**< Important status messages. */
41 L_TRACE, /**< Client exit and kill logging. */
42 L_INFO, /**< Logging of other operator commands. */
43 L_DEBUG, /**< Debug message output. */
44 L_LAST_LEVEL /**< Count of valid LogLevel values. */
49 LS_SYSTEM, /**< Operational status changes. */
50 LS_CONFIG, /**< Configuration errors and warnings. */
51 LS_OPERMODE, /**< Uses of OPMODE, CLEARMODE< etc. */
52 LS_GLINE, /**< Adding, (de-)activating or removing GLINEs. */
53 LS_JUPE, /**< Adding, (de-)activating or removing JUPEs. */
54 LS_WHO, /**< Use of extended WHO privileges. */
55 LS_NETWORK, /**< New server connections. */
56 LS_OPERKILL, /**< Kills by IRC operators. */
57 LS_SERVKILL, /**< Kills by servers. */
58 LS_USER, /**< User exits. */
59 LS_OPER, /**< Users becoming operators. */
60 LS_RESOLVER, /**< DNS resolver errors. */
61 LS_SOCKET, /**< Unexpected socket operation errors. */
62 LS_DEBUG, /**< Debug messages. */
63 LS_OLDLOG, /**< Old logging messages (no longer used). */
64 LS_LAST_SYSTEM /**< Count of valid LogSys values. */
67 extern void log_debug_init(int usetty);
68 extern void log_init(const char *process_name);
69 extern void log_reopen(void);
70 extern void log_close(void);
72 extern void log_write(enum LogSys subsys, enum LogLevel severity,
73 unsigned int flags, const char *fmt, ...);
74 extern void log_vwrite(enum LogSys subsys, enum LogLevel severity,
75 unsigned int flags, const char *fmt, va_list vl);
77 extern void log_write_kill(const struct Client *victim,
78 const struct Client *killer,
83 #define LOG_NOSYSLOG 0x01 /**< Do not send message to syslog. */
84 #define LOG_NOFILELOG 0x02 /**< Do not send message to a log file. */
85 #define LOG_NOSNOTICE 0x04 /**< Do not send message via server notice. */
86 /** Bitmask of suppression flags for log_write() and log_vwrite(). */
87 #define LOG_NOMASK (LOG_NOSYSLOG | LOG_NOFILELOG | LOG_NOSNOTICE)
89 extern char *log_canon(const char *subsys);
91 extern int log_set_file(const char *subsys, const char *filename);
92 extern char *log_get_file(const char *subsys);
94 extern int log_set_facility(const char *subsys, const char *facility);
95 extern char *log_get_facility(const char *subsys);
97 extern int log_set_snomask(const char *subsys, const char *facility);
98 extern char *log_get_snomask(const char *subsys);
100 extern int log_set_level(const char *subsys, const char *level);
101 extern char *log_get_level(const char *subsys);
103 extern int log_set_default(const char *facility);
104 extern char *log_get_default(void);
106 extern void log_feature_unmark(void);
107 extern int log_feature_mark(int flag);
108 extern void log_feature_report(struct Client *to, int flag);
110 #endif /* INCLUDED_ircd_log_h */