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

Error Manager

Error Manager. More...

Data Structures

struct  EMDATA
 Strukt for handling each msg. More...


Defines

#define MAX_STRLEN   1024
 Maximum length of handled strings.

#define EM_TYPE_SYSLOG   1
 Log message to syslogd.

#define EM_TYPE_STDERR   2
 Log message to stderr.

#define EM_TYPE_CALLBACK   4
 Log message with callback function.

#define EM_TYPE_FILE   8
 Log message to file.

#define MSG_DEBUG(args...)   {}
 Output a DEBUG Message, when the "logLevel" is minimum "LOG_DEBUG".

#define MSG_INF(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_INFO, ## args)
 Output a INFO Message, when the "logLevel" is minimum "LOG_INFO".

#define MSG_NOTICE(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_NOTICE, ## args)
 Output a NOTICE Message, when the "logLevel" is minimum "LOG_NOTICE".

#define MSG_WARNING(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_WARNING, ## args)
 Output a WARNING Message, when the "logLevel" is minimum "LOG_WARNING".

#define MSG_ERR(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ERR, ## args)
 Output a ERROR Message, when the "logLevel" is minimum "LOG_ERR".

#define MSG_CRIT(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_CRIT, ## args)
 Output a CRITICAL Message, when the "logLevel" is minimum "LOG_CRIT".

#define MSG_ALERT(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_ALERT, ## args)
 Output a ALERT Message, when the "logLevel" is minimum "LOG_ALERT".

#define MSG_EMERG(args...)   emManager(__FILE__, __FUNCTION__, __LINE__, LOG_EMERG, ## args)
 Output a EMERGENCY Message, when the "logLevel" is minimum "LOG_EMERG".


Typedefs

typedef EMDATA emData
 Strukt for handling each msg.


Functions

int emInit (int logLevel, int logType, void(*cb)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt), void *ctxt, char *filename)
 Init the Error Manager.

void emManager (char *pFile, char *pFunc, int iLine, int level, char *fmt,...)
 print messages to selected log medium


Detailed Description

Error Manager.

Author:
Stefan Bambach (stefan@bambach.biz)
Version:
0.1

Function Documentation

int emInit int  logLevel,
int  logType,
void(*  cb)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt),
void *  ctxt,
char *  filename
 

Init the Error Manager.

Parameters:
logLevel use on of this LOG_DEBUG | LOG_INFO | LOG_NOTICE | LOG_WARNING | LOG_ERR | LOG_CRIT | LOG_ALERT | LOG_EMERG
logType use EM_TYPE_SYSLOG for SYSLOG and EMTYPE_STDERR for stderr
cb callback function for self defined output handling
ctxt user defined data pointer (first parameter for callback function)
filename filename to log to, if not using syslogd
Returns:
the logType or the logLevel or 0
Note:
When you do not init, syslog is used. Do not use this function, use the define INIT_STDERR
Todo:
loggin in a File specific by filename

Definition at line 7 of file errmanager.c.

References EMDATA::ctxt, EM_TYPE_CALLBACK, EM_TYPE_STDERR, EM_TYPE_SYSLOG, emData, EMDATA::errCallBack, EMDATA::filename, EMDATA::logLevel, and EMDATA::logType.

Referenced by main().

void emManager char *  pFile,
char *  pFunc,
int  iLine,
int  level,
char *  fmt,
... 
 

print messages to selected log medium

Parameters:
pFile Filename of the function who has called the ErrorManager
pFunc Function name who has called the ErrorManager
iLine Linenumber of the function who has called the ErrorManager
level The Loglevel
fmt The output String
Returns:
void
Note:
: Do not use this function, use the defines.

Definition at line 54 of file errmanager.c.

References EMDATA::ctxt, EM_TYPE_CALLBACK, EMDATA::errCallBack, EMDATA::logLevel, EMDATA::logType, and MAX_STRLEN.


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