Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

errmanager.h

00001 
00010 #ifndef __ERRMANAGER_H__
00011 #define __ERRMANAGER_H__
00012 
00013 #ifdef HAVE_CONFIG_H
00014     #include <config.h>
00015 #endif
00016 
00017 #include <syslog.h>
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <string.h>
00021 #include <stdarg.h>
00022 #include <unistd.h>
00023 
00024 #define MAX_STRLEN 1024       
00026 #define EM_TYPE_SYSLOG 1      
00027 #define EM_TYPE_STDERR 2      
00028 #define EM_TYPE_CALLBACK 4    
00029 #define EM_TYPE_FILE 8        
00034 #ifdef WITH_DEBUG
00035     #define MSG_DEBUG(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_DEBUG, ## args)
00036 #else
00037     #define MSG_DEBUG(args...) {}
00038 #endif
00039 
00042    #define MSG_INF(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_INFO, ## args)
00043    
00047    #define MSG_NOTICE(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_NOTICE, ## args)
00048    
00052    #define MSG_WARNING(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_WARNING, ## args)
00053    
00057    #define MSG_ERR(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ERR, ## args)
00058    
00062    #define MSG_CRIT(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_CRIT, ## args)
00063    
00067    #define MSG_ALERT(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ALERT, ## args)
00068       
00072    #define MSG_EMERG(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_EMERG, ## args)
00073       
00074    
00075 
00079    typedef struct EMDATA {
00080       int logLevel;         
00081       int logType;          
00092         void (* errCallBack)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt);
00093         
00094       void *ctxt;           
00095       char *filename;       
00096    } emData;
00097    
00098    
00113    int emInit(int logLevel, int logType, void (*cb)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt), void *ctxt, char *filename);
00114    
00115    
00130     void emManager(char* pFile, char* pFunc, int iLine, int level, char* fmt, ...);
00131    
00132    
00133 #endif
00134 

Generated on Thu May 27 23:27:28 2004 for Mntd by doxygen 1.3.5