1 /* log.h - Diagnostic and error logging
2 * Copyright 2000-2003 srvx Development Team
4 * This file is part of srvx.
6 * srvx is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
42 void log_reopen(void);
45 /* bitmap values in flags parameter to log_audit */
46 #define AUDIT_HOSTMASK 0x01
48 struct log_type *log_register_type(const char *name, const char *default_log);
49 /* constraint for log_audit: sev one of LOG_COMMAND, LOG_OVERRIDE, LOG_STAFF */
50 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);
51 /* constraint for log_module: sev < LOG_COMMAND */
52 void log_module(struct log_type *type, enum log_severity sev, const char *format, ...) PRINTF_LIKE(3, 4);
53 void log_replay(struct log_type *type, int is_write, const char *line);
55 /* Log searching functions - ONLY searches log_audit'ed data */
59 /* field nullable in real entries? */
61 enum log_severity slvl;
62 struct userNode *bot; /* no */
63 char *channel_name; /* yes */
64 char *user_nick; /* no */
65 char *user_account; /* yes */
66 char *user_hostmask; /* yes */
67 char *command; /* no */
69 struct logEntry *next;
70 struct logEntry *prev;
75 struct logEntry masks;
76 struct log_type *type;
80 unsigned int severities;
85 struct userNode *reporter;
86 struct userNode *user;
89 typedef void (*entry_search_func)(struct logEntry *match, void *extra);
90 void log_report_entry(struct logEntry *match, void *extra);
91 struct logSearch* log_discrim_create(struct userNode *service, struct userNode *user, unsigned int argc, char *argv[]);
92 unsigned int log_entry_search(struct logSearch *discrim, entry_search_func esf, void *data);
93 void report_entry(struct userNode *service, struct userNode *user, struct logEntry *entry);