gobj_log_register_handler()

gobj_log_register_handler()#

Registers a new log handler by specifying its type and associated functions for logging and formatting messages.

Prototype

int gobj_log_register_handler(
    const char *handler_type,
    loghandler_close_fn_t close_fn,
    loghandler_write_fn_t write_fn,
    loghandler_fwrite_fn_t fwrite_fn
);

Parameters

Key

Type

Description

handler_type

const char *

The name of the log handler type to be registered.

close_fn

loghandler_close_fn_t

Function pointer for closing the log handler, or NULL if not applicable.

write_fn

loghandler_write_fn_t

Function pointer for writing log messages.

fwrite_fn

loghandler_fwrite_fn_t

Function pointer for formatted writing of log messages.


Return Value

Returns 0 on success, or -1 if the maximum number of log handler types has been reached.

Notes

This function allows the registration of custom log handlers, which can be later used with gobj_log_add_handler().

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples