<cahute/logging.h> – Logging control for Cahute

Macro definitions

CAHUTE_LOGLEVEL_INFO

Constant representing the info logging level; see Logging facilities with Cahute for more information.

CAHUTE_LOGLEVEL_WARNING

Constant representing the warning logging level; see Logging facilities with Cahute for more information.

CAHUTE_LOGLEVEL_ERROR

Constant representing the error logging level; see Logging facilities with Cahute for more information.

CAHUTE_LOGLEVEL_FATAL

Constant representing the fatal logging level; see Logging facilities with Cahute for more information.

CAHUTE_LOGLEVEL_NONE

Constant representing the special none logging level; see Logging facilities with Cahute for more information.

Type definitions

typedef void (cahute_log_func)(void *cookie, int level, char const *func, char const *message)

Function that can be called to emit a log message with parameters.

When called, this function is passed the following parameters:

cookie

Cookie set using cahute_set_log_func().

level

Level with which the message was emitted.

func

Name or prototype of the function that emitted the message; may be set to NULL in some cases.

message

Formatted content of the message that was emitted.

Function declarations

int cahute_get_log_level()

Get the current logging level, i.e. threshold of emitted messages.

Returns:

The current logging level.

void cahute_set_log_level(int level)

Set the current logging level, i.e. threshold of emitted message.

Parameters:
  • level – The logging level to set as the current one.

int cahute_set_log_func(cahute_log_func *func, void *cookie)

Set the function and related cookie used to emit logging messages.

Parameters:
  • func – Pointer to the function to use.

  • cookie – Cookie to pass to the function on every call.

Returns:

Cahute error.

int cahute_reset_log_func(void)

Reset the function and related cookie used to emit logging messages to the default one.