libspf2 1.2.11
Macros | Functions | Variables
spf_log.h File Reference
#include <stdarg.h>
Include dependency graph for spf_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPF_error(errmsg)   SPF_errorx( __FILE__, __LINE__, "%s", errmsg )
 
#define SPF_warning(errmsg)   SPF_warningx( __FILE__, __LINE__, "%s", errmsg )
 
#define SPF_info(errmsg)   SPF_infox( __FILE__, __LINE__, "%s", errmsg )
 
#define SPF_debug(errmsg)   SPF_debugx( __FILE__, __LINE__, "%s", errmsg )
 
#define SPF_errorf   SPF_errorx2
 
#define SPF_warningf   SPF_warningx2
 
#define SPF_infof   SPF_infox2
 
#define SPF_debugf   SPF_debugx2
 
#define SPF_DEFAULT_ERROR_HANDLER   SPF_error_stdio
 
#define SPF_DEFAULT_WARNING_HANDLER   SPF_warning_stdio
 
#define SPF_DEFAULT_INFO_HANDLER   SPF_info_stdio
 
#define SPF_DEFAULT_DEBUG_HANDLER   SPF_debug_stdio
 
#define SPF_ASSERT_NOTNULL(x)    do { if ((x) == NULL) SPF_error(#x " is NULL"); } while(0)
 

Functions

void SPF_errorx (const char *file, int line, const char *format,...) __attribute__((noreturn)) __attribute__((format(printf
 
void void SPF_errorx2 (const char *format,...)
 
void SPF_errorv (const char *file, int line, const char *format, va_list ap) __attribute__((noreturn)) __attribute__((format(printf
 
void SPF_warningx (const char *file, int line, const char *format,...) __attribute__((format(printf
 
void void SPF_warningx2 (const char *format,...)
 
void SPF_warningv (const char *file, int line, const char *format, va_list ap) __attribute__((format(printf
 
void SPF_infox (const char *file, int line, const char *format,...) __attribute__((format(printf
 
void void SPF_infox2 (const char *format,...)
 
void SPF_infov (const char *file, int line, const char *format, va_list ap) __attribute__((format(printf
 
void SPF_debugx (const char *file, int line, const char *format,...) __attribute__((format(printf
 
void void SPF_debugx2 (const char *format,...)
 
void SPF_debugv (const char *file, int line, const char *format, va_list ap) __attribute__((format(printf
 
void SPF_error_stdio (const char *file, int line, const char *errmsg) __attribute__((noreturn))
 
void SPF_warning_stdio (const char *file, int line, const char *errmsg)
 
void SPF_info_stdio (const char *file __attribute__((unused)), int line __attribute__((unused)), const char *errmsg)
 
void SPF_debug_stdio (const char *file, int line, const char *errmsg)
 
void SPF_error_syslog (const char *file, int line, const char *errmsg) __attribute__((noreturn))
 
void SPF_warning_syslog (const char *file, int line, const char *errmsg)
 
void SPF_info_syslog (const char *file __attribute__((unused)), int line __attribute__((unused)), const char *errmsg)
 
void SPF_debug_syslog (const char *file, int line, const char *errmsg)
 

Variables

void(* SPF_error_handler )(const char *, int, const char *) __attribute__((noreturn))
 
void(* SPF_warning_handler )(const char *, int, const char *)
 
void(* SPF_info_handler )(const char *, int, const char *)
 
void(* SPF_debug_handler )(const char *, int, const char *)
 

Detailed Description

Error messages and warnings generated internally by the library call these routines. By default, the messages go to stderr, but you can define your own routines to deal with the messages instead.

To use the syslog routines, add code such as:

openlog(logPrefix,LOG_PID|LOG_CONS|LOG_NDELAY|LOG_NOWAIT,LOG_MAIL);

SPF_error_handler = SPF_error_syslog; SPF_warning_handler = SPF_warning_syslog; SPF_info_handler = SPF_info_syslog; SPF_debug_handler = SPF_debug_syslog;

Definition in file spf_log.h.

Macro Definition Documentation

◆ SPF_ASSERT_NOTNULL

#define SPF_ASSERT_NOTNULL (   x)     do { if ((x) == NULL) SPF_error(#x " is NULL"); } while(0)

Definition at line 118 of file spf_log.h.

◆ SPF_debug

#define SPF_debug (   errmsg)    SPF_debugx( __FILE__, __LINE__, "%s", errmsg )

Definition at line 55 of file spf_log.h.

◆ SPF_debugf

#define SPF_debugf   SPF_debugx2

Definition at line 80 of file spf_log.h.

◆ SPF_DEFAULT_DEBUG_HANDLER

#define SPF_DEFAULT_DEBUG_HANDLER   SPF_debug_stdio

Definition at line 104 of file spf_log.h.

◆ SPF_DEFAULT_ERROR_HANDLER

#define SPF_DEFAULT_ERROR_HANDLER   SPF_error_stdio

Definition at line 101 of file spf_log.h.

◆ SPF_DEFAULT_INFO_HANDLER

#define SPF_DEFAULT_INFO_HANDLER   SPF_info_stdio

Definition at line 103 of file spf_log.h.

◆ SPF_DEFAULT_WARNING_HANDLER

#define SPF_DEFAULT_WARNING_HANDLER   SPF_warning_stdio

Definition at line 102 of file spf_log.h.

◆ SPF_error

#define SPF_error (   errmsg)    SPF_errorx( __FILE__, __LINE__, "%s", errmsg )

Definition at line 40 of file spf_log.h.

◆ SPF_errorf

#define SPF_errorf   SPF_errorx2

Definition at line 77 of file spf_log.h.

◆ SPF_info

#define SPF_info (   errmsg)    SPF_infox( __FILE__, __LINE__, "%s", errmsg )

Definition at line 50 of file spf_log.h.

◆ SPF_infof

#define SPF_infof   SPF_infox2

Definition at line 79 of file spf_log.h.

◆ SPF_warning

#define SPF_warning (   errmsg)    SPF_warningx( __FILE__, __LINE__, "%s", errmsg )

Definition at line 45 of file spf_log.h.

◆ SPF_warningf

#define SPF_warningf   SPF_warningx2

Definition at line 78 of file spf_log.h.

Function Documentation

◆ SPF_debug_stdio()

void SPF_debug_stdio ( const char *  file,
int  line,
const char *  errmsg 
)

Definition at line 67 of file spf_log_stdio.c.

◆ SPF_debug_syslog()

void SPF_debug_syslog ( const char *  file,
int  line,
const char *  errmsg 
)

◆ SPF_debugv()

void SPF_debugv ( const char *  file,
int  line,
const char *  format,
va_list  ap 
)

◆ SPF_debugx()

void SPF_debugx ( const char *  file,
int  line,
const char *  format,
  ... 
)

◆ SPF_debugx2()

void void SPF_debugx2 ( const char *  format,
  ... 
)

Definition at line 194 of file spf_log.c.

References NULL, and SPF_debugv().

Here is the call graph for this function:

◆ SPF_error_stdio()

void SPF_error_stdio ( const char *  file,
int  line,
const char *  errmsg 
)

Definition at line 34 of file spf_log_stdio.c.

◆ SPF_error_syslog()

void SPF_error_syslog ( const char *  file,
int  line,
const char *  errmsg 
)

◆ SPF_errorv()

void SPF_errorv ( const char *  file,
int  line,
const char *  format,
va_list  ap 
)

◆ SPF_errorx()

void SPF_errorx ( const char *  file,
int  line,
const char *  format,
  ... 
)

◆ SPF_errorx2()

void void SPF_errorx2 ( const char *  format,
  ... 
)

Definition at line 167 of file spf_log.c.

References NULL, and SPF_errorv().

Here is the call graph for this function:

◆ SPF_info_stdio()

void SPF_info_stdio ( const char *file   __attribute__(unused),
int line   __attribute__(unused),
const char *  errmsg 
)

Definition at line 61 of file spf_log_stdio.c.

◆ SPF_info_syslog()

void SPF_info_syslog ( const char *file   __attribute__(unused),
int line   __attribute__(unused),
const char *  errmsg 
)

◆ SPF_infov()

void SPF_infov ( const char *  file,
int  line,
const char *  format,
va_list  ap 
)

◆ SPF_infox()

void SPF_infox ( const char *  file,
int  line,
const char *  format,
  ... 
)

◆ SPF_infox2()

void void SPF_infox2 ( const char *  format,
  ... 
)

Definition at line 185 of file spf_log.c.

References NULL, and SPF_infov().

Here is the call graph for this function:

◆ SPF_warning_stdio()

void SPF_warning_stdio ( const char *  file,
int  line,
const char *  errmsg 
)

Definition at line 48 of file spf_log_stdio.c.

◆ SPF_warning_syslog()

void SPF_warning_syslog ( const char *  file,
int  line,
const char *  errmsg 
)

◆ SPF_warningv()

void SPF_warningv ( const char *  file,
int  line,
const char *  format,
va_list  ap 
)

◆ SPF_warningx()

void SPF_warningx ( const char *  file,
int  line,
const char *  format,
  ... 
)

◆ SPF_warningx2()

void void SPF_warningx2 ( const char *  format,
  ... 
)

Definition at line 176 of file spf_log.c.

References NULL, and SPF_warningv().

Here is the call graph for this function:

Variable Documentation

◆ SPF_debug_handler

void(* SPF_debug_handler) (const char *, int, const char *) ( const char *  ,
int  ,
const char *   
)
extern

Referenced by SPF_debugv(), and SPF_debugx().

◆ SPF_error_handler

void(* SPF_error_handler) (const char *, int, const char *) __attribute__((noreturn)) ( const char *  ,
int  ,
const char *   
)
extern

Referenced by SPF_errorv(), and SPF_errorx().

◆ SPF_info_handler

void(* SPF_info_handler) (const char *, int, const char *) ( const char *  ,
int  ,
const char *   
)
extern

Referenced by SPF_infov(), and SPF_infox().

◆ SPF_warning_handler

void(* SPF_warning_handler) (const char *, int, const char *) ( const char *  ,
int  ,
const char *   
)
extern

Referenced by SPF_warningv(), and SPF_warningx().