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

errmanager.h

00001 
00011 #ifndef __ERRMANAGER_H__
00012 #define __ERRMANAGER_H__
00013 
00014 #ifdef HAVE_CONFIG_H
00015     #include <config.h>
00016 #endif
00017 
00018 #include <syslog.h>
00019 #include <stdio.h>
00020 #include <stdlib.h>
00021 #include <string.h>
00022 #include <stdarg.h>
00023 #include <unistd.h>
00024 
00025 #define MAX_STRLEN 1024             
00027 #define EM_TYPE_SYSLOG 1            
00028 #define EM_TYPE_STDERR 2            
00029 #define EM_TYPE_CALLBACK 4          
00030 #define EM_TYPE_FILE 8              
00032 #define ERRNO set_errno             
00033 #define ERRNULL set_errno_null      
00039 #ifdef WITH_DEBUG
00040     #define MSG_DEBUG(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_DEBUG, ## args)
00041 #else
00042     #define MSG_DEBUG(args...) {}
00043 #endif
00044 
00047    #define MSG_INF(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_INFO, ## args)
00048    
00052    #define MSG_NOTICE(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_NOTICE, ## args)
00053    
00057    #define MSG_WARNING(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_WARNING, ## args)
00058    
00062    #define MSG_ERR(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ERR, ## args)
00063    
00067    #define MSG_CRIT(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_CRIT, ## args)
00068    
00072    #define MSG_ALERT(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ALERT, ## args)
00073       
00077    #define MSG_EMERG(args...) emManager(__FILE__, __FUNCTION__, __LINE__, LOG_EMERG, ## args)
00078       
00079    
00080 
00084    typedef struct EMDATA {
00085       int logLevel;         
00086       int logType;          
00097         void (* errCallBack)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt);
00098         
00099       void *ctxt;           
00100       char *filename;       
00101    } emData;
00102     
00103 
00110     int set_errno(int err);
00111     
00112 
00119     void *set_errno_null(int err);
00120     
00121     
00125     void emClose(void);
00126     
00127     
00143    int emInit(int logLevel, int logType, void (*cb)(void *ctxt, char *pFile, 
00144         char *pFunc, int iLine, int level, char *fmt), void *ctxt, 
00145         char *filename, const char *name);
00146    
00147    
00162     void emManager(char* pFile, char* pFunc, int iLine, int level, char* fmt, ...);
00163    
00164    
00165 #endif
00166 

Generated on Wed Mar 30 13:43:26 2005 for Mntd by  doxygen 1.3.9.1