OrcDebug

## OrcDebug OrcDebug — Printing and formatting debug information |

## Synopsis

    enum                OrcDebugLevel;
    void                (*OrcDebugPrintFunc)                (int level,
                                                             const char *file,
                                                             const char *func,
                                                             int line,
                                                             const char *format,
                                                             va_list varargs);
    #define             ORC_DEBUG_PRINT                     (level,
                                                             ...)
    #define             ORC_ERROR                           (...)
    #define             ORC_WARNING                         (...)
    #define             ORC_INFO                            (...)
    #define             ORC_DEBUG                           (...)
    #define             ORC_LOG                             (...)
    #define             ORC_FUNCTION
    int                 orc_debug_get_level                 (void);
    void                orc_debug_print                     (int level,
                                                             const char *file,
                                                             const char *func,
                                                             int line,
                                                             const char *format,
                                                             ...);
    void                orc_debug_set_level                 (int level);
    void                orc_debug_set_print_function        (OrcDebugPrintFunc func);

## Description

## Details

### enum OrcDebugLevel

    typedef enum {
      ORC_DEBUG_NONE = 0,
      ORC_DEBUG_ERROR,
      ORC_DEBUG_WARNING,
      ORC_DEBUG_INFO,
      ORC_DEBUG_DEBUG,
      ORC_DEBUG_LOG
    } OrcDebugLevel;

Enumeration describing debug levels in Orc.

`ORC_DEBUG_NONE` | No debugging. Used to disable debugging output.
`ORC_DEBUG_ERROR` | The level for messages indicating that an error has occurred that causes Orc to produce incorrect results. Also used temporarily by developers for testing code.
`ORC_DEBUG_WARNING` | Messages at this level indicate something has occurred that a developer looking into an application problem may want to know.
`ORC_DEBUG_INFO` | Messages at this level provide high-level information about Orc internals.
`ORC_DEBUG_DEBUG` | The default level for logging messages.
`ORC_DEBUG_LOG` | The level for messages that probably don't need to be logged at all.

### OrcDebugPrintFunc ()

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

Typedef describing functions that can be registered using `orc_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

### ORC_DEBUG_PRINT()

    #define             ORC_DEBUG_PRINT(level, ...)

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

`level` : | debug level of message

### ORC_ERROR()

    #define ORC_ERROR(...) ORC_DEBUG_PRINT(ORC_DEBUG_ERROR, __VA_ARGS__)

Macro to call `ORC_DEBUG_PRINT()` with a level of ORC_DEBUG_ERROR.

`...` : | printf-style format and arguments

### ORC_WARNING()

    #define ORC_WARNING(...) ORC_DEBUG_PRINT(ORC_DEBUG_WARNING, __VA_ARGS__)

Macro to call `ORC_DEBUG_PRINT()` with a level of ORC_DEBUG_WARNING.

`...` : | printf-style format and arguments

### ORC_INFO()

    #define ORC_INFO(...) ORC_DEBUG_PRINT(ORC_DEBUG_INFO, __VA_ARGS__)

Macro to call `ORC_DEBUG_PRINT()` with a level of ORC_DEBUG_INFO.

`...` : | printf-style format and arguments

### ORC_DEBUG()

    #define ORC_DEBUG(...) ORC_DEBUG_PRINT(ORC_DEBUG_DEBUG, __VA_ARGS__)

Macro to call `ORC_DEBUG_PRINT()` with a level of ORC_DEBUG_DEBUG.

`...` : | printf-style format and arguments

### ORC_LOG()

    #define ORC_LOG(...) ORC_DEBUG_PRINT(ORC_DEBUG_LOG, __VA_ARGS__)

Macro to call `ORC_DEBUG_PRINT()` with a level of ORC_DEBUG_LOG.

`...` : | printf-style format and arguments

### ORC_FUNCTION

    #define ORC_FUNCTION __PRETTY_FUNCTION__

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

### orc_debug_get_level ()

    int                 orc_debug_get_level                 (void);

Gets the current debug level.

Returns : | the current debug level

### orc_debug_print ()

    void                orc_debug_print                     (int level,
                                                             const char *file,
                                                             const char *func,
                                                             int line,
                                                             const char *format,
                                                             ...);

### orc_debug_set_level ()

    void                orc_debug_set_level                 (int level);

Sets the current debug level.

`level` : | the new debug level

### orc_debug_set_print_function ()

    void                orc_debug_set_print_function        (OrcDebugPrintFunc 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` : | the function to call