]>
jfr.im git - irc/evilnet/x3.git/blob - src/log.h
1 /* log.h - Diagnostic and error logging
2 * Copyright 2000-2003 srvx Development Team
4 * This file is part of x3.
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.
26 #define AccountingLog "everything.log"
44 void log_reopen(void);
47 /* bitmap values in flags parameter to log_audit */
48 #define AUDIT_HOSTMASK 0x01
50 struct log_type
*log_register_type(const char *name
, const char *default_log
);
51 /* constraint for log_audit: sev one of LOG_COMMAND, LOG_OVERRIDE, LOG_STAFF */
52 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
);
53 /* constraint for log_module: sev < LOG_COMMAND */
54 void log_module(struct log_type
*type
, enum log_severity sev
, const char *format
, ...) PRINTF_LIKE(3, 4);
55 void log_replay(struct log_type
*type
, int is_write
, const char *line
);
57 /* Log searching functions - ONLY searches log_audit'ed data */
61 /* field nullable in real entries? */
63 enum log_severity slvl
;
64 struct userNode
*bot
; /* no */
65 char *channel_name
; /* yes */
66 char *user_nick
; /* no */
67 char *user_account
; /* yes */
68 char *user_hostmask
; /* yes */
69 char *command
; /* no */
71 struct logEntry
*next
;
72 struct logEntry
*prev
;
77 struct logEntry masks
;
78 struct log_type
*type
;
82 unsigned int severities
;
87 struct userNode
*reporter
;
88 struct userNode
*user
;
91 typedef void (*entry_search_func
)(struct logEntry
*match
, void *extra
);
92 void log_report_entry(struct logEntry
*match
, void *extra
);
93 struct logSearch
* log_discrim_create(struct userNode
*service
, struct userNode
*user
, unsigned int argc
, char *argv
[]);
94 unsigned int log_entry_search(struct logSearch
*discrim
, entry_search_func esf
, void *data
);
95 void report_entry(struct userNode
*service
, struct userNode
*user
, struct logEntry
*entry
);
96 void SyncLog(char *fmt
,...);
97 int ShowLog(struct userNode
*user
, struct chanNode
*cptr
, char *chan
, char *nuh
, char *command
, char *rest
, int maxlines
);