Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_log.h

Go to the documentation of this file.
00001 /* 00002 * $Id: gi_log.h,v 1.1.2.11 2004/08/06 09:51:47 jasta Exp $ 00003 * 00004 * Copyright (C) 2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __GI_LOG_H 00018 #define __GI_LOG_H 00019 00020 /*****************************************************************************/ 00021 00029 /*****************************************************************************/ 00030 00034 #define GI_LOG_FATAL (0x01) 00035 #define GI_LOG_EMERG (0x02) 00036 #define GI_LOG_ERROR (0x04) 00037 #define GI_LOG_WARNING (0x08) 00038 #define GI_LOG_DEBUG (0x20) 00039 #define GI_LOG_DEPRECATED (0x100) 00040 00041 #define GI_LOG_ALL (0x13f) 00042 #define GI_LOG_NONE (0x00) 00043 00047 #define GI_LOG_STDOUT (0x01) 00048 #define GI_LOG_STDERR (0x02) 00049 #define GI_LOG_TIMESTAMP (0x20) /* prepend a timestamp to each msg */ 00050 #define GI_LOG_NODOMAINPFX (0x40) 00051 00052 /*****************************************************************************/ 00053 00054 EXTERN_C_BEGIN 00055 00056 /*****************************************************************************/ 00057 00086 LIBGIFT_EXPORT 00087 void gi_log_init (const char *ident, int output, int domain_mask, int level); 00088 00093 LIBGIFT_EXPORT 00094 void gi_log_finish (void); 00095 00102 LIBGIFT_EXPORT 00103 FILE *gi_log_open (const char *pathname); 00104 00109 LIBGIFT_EXPORT 00110 void gi_log_close (FILE *f); 00111 00112 /*****************************************************************************/ 00113 00152 LIBGIFT_EXPORT 00153 int gi_log_vprintf (const char *file, unsigned int line, const char *funcname, 00154 int domain, int level, const char *fmt, va_list args); 00155 00159 LIBGIFT_EXPORT 00160 int gi_log_printf (int domain, int level, const char *fmt, ...); 00161 00162 /*****************************************************************************/ 00163 00164 /* 00165 * When we're on a gcc platform, provide printf format vigilance during 00166 * compilation. 00167 */ 00168 #if defined(__GNUC__) 00169 # define GI_PRINTF_ATTR(f,v) __attribute__ ((__format__ (__printf__, f, v))) 00170 #else 00171 # define GI_PRINTF_ATTR(f,v) 00172 #endif 00173 00179 #define GI_LOG_WRAPPER(__funcfn__) \ 00180 LIBGIFT_EXPORT \ 00181 int __funcfn__ (int level, const char *fmt, ...) \ 00182 GI_PRINTF_ATTR (2, 3) 00183 00184 GI_LOG_WRAPPER(gi_log_simple); 00185 GI_LOG_WRAPPER(gi_log_warning); 00186 GI_LOG_WRAPPER(gi_log_error); 00187 GI_LOG_WRAPPER(gi_log_emerg); 00188 GI_LOG_WRAPPER(gi_log_fatal); 00189 00190 /*****************************************************************************/ 00191 00192 #ifndef __FUNCTION__ 00193 #define __FUNCTION__ __func__ 00194 #endif 00195 00196 #define GI_TRACE __FILE__, __LINE__, __FUNCTION__ 00197 #define GI_TRACEL __FILE__, 0, NULL 00198 00199 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 00200 # define gi_log_debug(lvl,fmt,...) gi_log_debugfn(GI_TRACE,lvl,fmt,__VA_ARGS__) 00201 # define gi_log_message(lvl,fmt,...) gi_log_debugfn(GI_TRACEL,lvl,fmt,__VA_ARGS__) 00202 #elif defined(__GNUC__) 00203 # define gi_log_debug(lvl,fmt...) gi_log_debugfn(GI_TRACE,lvl,fmt) 00204 # define gi_log_message(lvl,fmt...) gi_log_debugfn(GI_TRACEL,lvl,fmt) 00205 #else 00206 # define gi_log_debug gi_log_simple 00207 # define gi_log_message gi_log_simple 00208 #endif 00209 00217 LIBGIFT_EXPORT 00218 int gi_log_debugfn (const char *file, unsigned int line, const char *funcname, 00219 int level, const char *fmt, ...) 00220 GI_PRINTF_ATTR (5, 6); 00221 00222 /*****************************************************************************/ 00223 00224 EXTERN_C_END 00225 00226 /*****************************************************************************/ 00227 00228 #endif /* __GI_LOG_H */

Generated on Sun Aug 22 07:56:40 2004 by doxygen 1.3.7