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

Error Manager
[SB Library]

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 ERRNO   set_errno
 set_errno macro
#define ERRNULL   set_errno_null
 set_errno_null macro
#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 set_errno (int err)
 Setting errno to err and return -1.
void * set_errno_null (int err)
 Setting errno to err and return NULL.
void emClose (void)
 Quit the Error Manager.
int emInit (int logLevel, int logType, void(*cb)(void *ctxt, char *pFile, char *pFunc, int iLine, int level, char *fmt), void *ctxt, char *filename, const char *name)
 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:
Oliver Feige <ofeige@gmx.de>
Version:
0.1

Function Documentation

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

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
name name of package
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 29 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(), mntd_volume_config_reload(), and sb_daemon_init().

int set_errno int  err  ) 
 

Setting errno to err and return -1.

Parameters:
err errno value to set to
Returns:
-1

Definition at line 9 of file errmanager.c.

void* set_errno_null int  err  ) 
 

Setting errno to err and return NULL.

Parameters:
err errno value to set to
Returns:
NULL

Definition at line 16 of file errmanager.c.


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