Debug

Debug — Printing and formatting debug information

Synopsis




void        (*OilDebugPrintFunc)            (int level,
                                             const char *file,
                                             const char *func,
                                             int line,
                                             const char *format,
                                             va_list varargs);
enum        OilDebugLevel;
void        oil_debug_set_print_function    (OilDebugPrintFunc func);
int         oil_debug_get_level             (void);
void        oil_debug_set_level             (int level);
#define     OIL_ERROR                       (...)
#define     OIL_WARNING                     (...)
#define     OIL_INFO                        (...)
#define     OIL_DEBUG                       (...)
#define     OIL_LOG                         (...)
#define     OIL_FUNCTION
#define     OIL_DEBUG_PRINT                 (level, ...)

Description

Details

OilDebugPrintFunc ()

void        (*OilDebugPrintFunc)            (int level,
                                             const char *file,
                                             const char *func,
                                             int line,
                                             const char *format,
                                             va_list varargs);

Typedef describing functions that can be registered using oil_debug_set_print_function() so that it is called to print debugging messages.

level : the debug level
file : name of the file where the debug message occurs
func : name of the function where the debug message occurs
line : line in the file where the debug message occurs
format : a printf format
varargs : varargs for the printf format

enum OilDebugLevel

typedef enum {
  OIL_DEBUG_NONE = 0,
  OIL_DEBUG_ERROR,
  OIL_DEBUG_WARNING,
  OIL_DEBUG_INFO,
  OIL_DEBUG_DEBUG,
  OIL_DEBUG_LOG
} OilDebugLevel;

Enumeration describing debug levels in Liboil.


oil_debug_set_print_function ()

void        oil_debug_set_print_function    (OilDebugPrintFunc func);

Sets the function to call when outputting debugging information. A value of NULL for func will restore the default handler, which prints debugging information to stderr.

func :

oil_debug_get_level ()

int         oil_debug_get_level             (void);

Gets the current debug level.

Returns : the current debug level

oil_debug_set_level ()

void        oil_debug_set_level             (int level);

Sets the current debug level.

level : the new debug level

OIL_ERROR()

#define OIL_ERROR(...) OIL_DEBUG_PRINT(OIL_DEBUG_ERROR, __VA_ARGS__)

Macro to call OIL_DEBUG_PRINT() with a level of OIL_DEBUG_ERROR.

... :

OIL_WARNING()

#define OIL_WARNING(...) OIL_DEBUG_PRINT(OIL_DEBUG_WARNING, __VA_ARGS__)

Macro to call OIL_DEBUG_PRINT() with a level of OIL_DEBUG_WARNING.

... :

OIL_INFO()

#define OIL_INFO(...) OIL_DEBUG_PRINT(OIL_DEBUG_INFO, __VA_ARGS__)

Macro to call OIL_DEBUG_PRINT() with a level of OIL_DEBUG_INFO.

... :

OIL_DEBUG()

#define OIL_DEBUG(...) OIL_DEBUG_PRINT(OIL_DEBUG_DEBUG, __VA_ARGS__)

Macro to call OIL_DEBUG_PRINT() with a level of OIL_DEBUG_DEBUG.

... :

OIL_LOG()

#define OIL_LOG(...) OIL_DEBUG_PRINT(OIL_DEBUG_LOG, __VA_ARGS__)

Macro to call OIL_DEBUG_PRINT() with a level of OIL_DEBUG_LOG.

... :

OIL_FUNCTION

#define     OIL_FUNCTION

Internal macro that points to __PRETTY_FUNCTION__ or __func__ if the former is not available.


OIL_DEBUG_PRINT()

#define     OIL_DEBUG_PRINT(level, ...)

Macro to call _oil_debug_print() with the correct values for the name of the source file, line of source file, and function.

level :
... :