jabberd2
2.2.16
|
00001 /* 00002 * jabberd - Jabber Open Source Server 00003 * Copyright (c) 2002-2004 Jeremie Miller, Thomas Muldowney, 00004 * Ryan Eatmon, Robert Norris 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA 00019 */ 00020 00028 #ifndef INCL_UTIL_LOG_H 00029 #define INCL_UTIL_LOG_H 1 00030 00031 #ifdef HAVE_CONFIG_H 00032 # include <config.h> 00033 #endif 00034 00035 #ifdef HAVE_SYSLOG_H 00036 # include <syslog.h> 00037 #endif 00038 00039 #include "pool.h" 00040 00041 typedef enum { 00042 log_STDOUT, 00043 log_SYSLOG, 00044 log_FILE 00045 } log_type_t; 00046 00047 /* opaque decl */ 00048 typedef struct _log_st *log_t; 00049 00050 JABBERD2_API log_t log_new(pool_t p, log_type_t type, char *ident, char *facility); 00051 JABBERD2_API void log_write(log_t log, int level, const char *msgfmt, ...); 00052 00053 /* debug logging */ 00054 #if defined(DEBUG) && 0 00055 JABBERD2_API int log_debug_flag; 00056 void log_debug(char *file, int line, char *subsys, const char *msgfmt, ...); 00057 00058 # define log_debug_get_flag() log_debug_flag 00059 # define log_debug_set_flag(f) (log_debug_flag = f ? 1 : 0) 00060 # define log_debug(...) if(log_debug_flag) __log_debug(__FILE__,__LINE__,0,__VA_ARGS__) 00061 # define log_debug_subsys(...) if(log_debug_flag) __log_debug(__FILE__,__LINE__,__VA_ARGS__) 00062 #else 00063 # define log_debug_get_flag() (0) 00064 # define log_debug_set_flag(f) 00065 # define log_debug(...) 00066 # define log_debug_subsys(...) 00067 #endif 00068 00069 #endif