Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kStatus kApiLib_AddLogHandler ( kApiLogFx  function,
kPointer  receiver 
)

Adds a handler function for logging operations.

By default, logging operations are ignored (log information discarded) unless the application/framework adds log handlers.

One log handler can be installed before calling kApiLib_Construct, for the purpose of logging before the kApi library is fully initialized. Additional log handlers can be added after the kApi library is initialized.

Note that log callbacks are invoked while an internal log lock is held. Accordingly, caution should be exercised in log handlers to avoid potential deadlock. E.g., if the internal log lock is considered lock A, and the log handler acquires lock B, the application should take care to ensure that these locks are never acquired in the opposite order (i.e., B, then A). This could happen if application code acquires lock B and then calls a logging function such as kLogf.

Parameters
functionLog callback function.
receiverLog callback context pointer.
Returns
Operation status.