00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef lint
00021 static const char rcsid[] = "$Id: logging.c,v 1.3 2004-10-17 05:14:06 stdarg Exp $";
00022 #endif
00023
00024 #include <eggdrop/eggdrop.h>
00025
00026 static bind_table_t *BT_log = NULL;
00027
00028 void logging_init(void)
00029 {
00030 BT_log = bind_table_add(BTN_LOG, 4, "issi", MATCH_NONE, BIND_STACKABLE);
00031 }
00032
00033 void logging_shutdown(void)
00034 {
00035 bind_table_del(BT_log);
00036 }
00037
00038 int putlog(int flags, const char *chan, const char *format, ...)
00039 {
00040 va_list args;
00041 char *ptr, buf[1024];
00042 int len;
00043
00044 va_start(args, format);
00045 ptr = egg_mvsprintf(buf, sizeof(buf), &len, format, args);
00046 va_end(args);
00047 bind_check(BT_log, NULL, NULL, flags, chan, ptr, len);
00048 if (ptr != buf) free(ptr);
00049 return(len);
00050 }