GNU libmicrohttpd  0.9.72
logging

Typedefs

typedef void(* MHD_LogCallback) (void *cls, const char *fm, va_list ap)
 
typedef void(* MHD_PanicCallback) (void *cls, const char *file, unsigned int line, const char *reason)
 

Functions

_MHD_EXTERN void MHD_set_panic_func (MHD_PanicCallback cb, void *cls)
 
static void file_logger (void *cls, enum MHD_StatusCode sc, const char *fm, va_list ap)
 

Detailed Description

MHD API to mange logging and error handling

Typedef Documentation

◆ MHD_LogCallback

typedef void(* MHD_LogCallback) (void *cls, const char *fm, va_list ap)

Type of a callback function used for logging by MHD.

Parameters
clsclosure
fmformat string (printf()-style)
aparguments to fm

Definition at line 1351 of file microhttpd.h.

◆ MHD_PanicCallback

typedef void(* MHD_PanicCallback) (void *cls, const char *file, unsigned int line, const char *reason)

Callback for serious error condition. The default action is to print an error message and abort().

Parameters
clsuser specified value
filewhere the error occurred
linewhere the error occurred
reasonerror detail, may be NULL

Definition at line 2130 of file microhttpd.h.

Function Documentation

◆ file_logger()

static void file_logger ( void *  cls,
enum MHD_StatusCode  sc,
const char *  fm,
va_list  ap 
)
static

Logging implementation that logs to a file given as the cls.

Parameters
clsa FILE * to log to
scstatus code of the event (ignored)
fmformat string (printf()-style)
aparguments to fm

Definition at line 40 of file daemon_create.c.

Referenced by MHD_daemon_create().

Here is the caller graph for this function:

◆ MHD_set_panic_func()

void MHD_set_panic_func ( MHD_PanicCallback  cb,
void *  cls 
)

Sets the global error handler to a different implementation. cb will only be called in the case of typically fatal, serious internal consistency issues. These issues should only arise in the case of serious memory corruption or similar problems with the architecture. While cb is allowed to return and MHD will then try to continue, this is never safe.

The default implementation that is used if no panic function is set simply prints an error message and calls abort(). Alternative implementations might call exit() or other similar functions.

Parameters
cbnew error handler
clspassed to cb

Definition at line 56 of file panic.c.

References mhd_panic, and mhd_panic_cls.