jabberd2  2.2.17
log.h
Go to the documentation of this file.
1 /*
2  * jabberd - Jabber Open Source Server
3  * Copyright (c) 2002-2004 Jeremie Miller, Thomas Muldowney,
4  * Ryan Eatmon, Robert Norris
5  *
6  * This program 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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19  */
20 
28 #ifndef INCL_UTIL_LOG_H
29 #define INCL_UTIL_LOG_H 1
30 
31 #ifdef HAVE_CONFIG_H
32 # include <config.h>
33 #endif
34 
35 #ifdef HAVE_SYSLOG_H
36 # include <syslog.h>
37 #endif
38 
39 #include "pool.h"
40 
41 typedef enum {
45 } log_type_t;
46 
47 /* opaque decl */
48 typedef struct _log_st *log_t;
49 
50 JABBERD2_API log_t log_new(pool_t p, log_type_t type, char *ident, char *facility);
51 JABBERD2_API void log_write(log_t log, int level, const char *msgfmt, ...);
52 
53 /* debug logging */
54 #if defined(DEBUG) && 0
55 JABBERD2_API int log_debug_flag;
56 void log_debug(char *file, int line, char *subsys, const char *msgfmt, ...);
57 
58 # define log_debug_get_flag() log_debug_flag
59 # define log_debug_set_flag(f) (log_debug_flag = f ? 1 : 0)
60 # define log_debug(...) if(log_debug_flag) __log_debug(__FILE__,__LINE__,0,__VA_ARGS__)
61 # define log_debug_subsys(...) if(log_debug_flag) __log_debug(__FILE__,__LINE__,__VA_ARGS__)
62 #else
63 # define log_debug_get_flag() (0)
64 # define log_debug_set_flag(f)
65 # define log_debug(...)
66 # define log_debug_subsys(...)
67 #endif
68 
69 #endif