1 /* log.h - Diagnostic and error logging
2 * Copyright 2000-2003 srvx Development Team
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 2 of the License, or
7 * (at your option) any later version. Important limitations are
8 * listed in the COPYING file that accompanies this software.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, email srvx-maintainers@srvx.net.
40 void log_reopen(void);
43 /* bitmap values in flags parameter to log_audit */
44 #define AUDIT_HOSTMASK 0x01
46 struct log_type *log_register_type(const char *name, const char *default_log);
47 /* constraint for log_audit: sev one of LOG_COMMAND, LOG_OVERRIDE, LOG_STAFF */
48 void log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, struct userNode *bot, const char *channel_name, unsigned int flags, const char *command);
49 /* constraint for log_module: sev < LOG_COMMAND */
50 void log_module(struct log_type *type, enum log_severity sev, const char *format, ...) PRINTF_LIKE(3, 4);
51 void log_replay(struct log_type *type, int is_write, const char *line);
53 /* Log searching functions - ONLY searches log_audit'ed data */
57 /* field nullable in real entries? */
59 enum log_severity slvl;
60 struct userNode *bot; /* no */
61 char *channel_name; /* yes */
62 char *user_nick; /* no */
63 char *user_account; /* yes */
64 char *user_hostmask; /* yes */
65 char *command; /* no */
67 struct logEntry *next;
68 struct logEntry *prev;
73 struct logEntry masks;
74 struct log_type *type;
78 unsigned int severities;
83 struct userNode *reporter;
84 struct userNode *user;
87 typedef void (*entry_search_func)(struct logEntry *match, void *extra);
88 void log_report_entry(struct logEntry *match, void *extra);
89 struct logSearch* log_discrim_create(struct userNode *service, struct userNode *user, unsigned int argc, char *argv[]);
90 unsigned int log_entry_search(struct logSearch *discrim, entry_search_func esf, void *data);
91 void report_entry(struct userNode *service, struct userNode *user, struct logEntry *entry);