Droplet
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Enumerations | Functions
Initialization

Initializing the Droplet library. More...

Typedefs

typedef void(* dpl_log_func_t )(dpl_ctx_t *, dpl_log_level_t, const char *message)
 Callback function for log messages, see dpl_set_log_func()
 

Enumerations

enum  dpl_log_level_t { DPL_DEBUG, DPL_INFO, DPL_WARNING, DPL_ERROR }
 Message severity levels for Droplet log messages. More...
 

Functions

dpl_status_t dpl_init ()
 Initialize Droplet global data. More...
 
void dpl_free ()
 Free Droplet global data. More...
 
void dpl_set_log_func (dpl_log_func_t logfunc)
 Set logging callback function. More...
 

Detailed Description

These functions are used to initialize global data used by Droplet library.

Enumeration Type Documentation

Enumerator
DPL_DEBUG 

debug message (lowest)

DPL_INFO 

informational message

DPL_WARNING 

warning message

DPL_ERROR 

error message (highest)

Function Documentation

void dpl_free ( void  )

Must be called once and only once after all Droplet library calls have stopped.

dpl_status_t dpl_init ( void  )

Initializes global data used by the library. Must be called once and only once before any other Droplet library functions. The next step after calling dpl_init() is probably dpl_ctx_new().

Return values
DPL_SUCCESSthis function cannot currently fail
void dpl_set_log_func ( dpl_log_func_t  logfunc)

Set a function that will be called to handle every log message emitted by the Droplet library. Passing NULL for logfunc resets the Droplet library to using it's default internal logging which emits log messages to the process' stderr. The logfunc is called with a pre-formatted string representing a single line of log output with no newline. It is also passed a dpl_ctx_t* which may be NULL or may point to a context associated with the error.

This function is not thread-safe. Do not call it while other threads are running Droplet library code. It is recommended you call the function just after calling dpl_init().

Parameters
logfuncthe callback function or NULL for default behaviour