aubio: utils/log.h File Reference

aubio 0.4.9

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
log.h File Reference

Logging features. More...

Go to the source code of this file.

## Typedefs
typedef void(* | aubio_log_function_t) (sint_t level, const char_t *message, void *data)
| Logging function prototype, to be passed to aubio_log_set_function.

## Enumerations
enum | aubio_log_level { AUBIO_LOG_ERR , AUBIO_LOG_INF , AUBIO_LOG_MSG , AUBIO_LOG_DBG , AUBIO_LOG_WRN , AUBIO_LOG_LAST_LEVEL }
| list of logging levels More...

## Functions
void | aubio_log_set_function (aubio_log_function_t fun, void *data)
| Set logging function for all levels.
aubio_log_function_t | aubio_log_set_level_function (sint_t level, aubio_log_function_t fun, void *data)
| Set logging function for a given level.
void | aubio_log_reset (void)
| Reset all logging functions to the default one.

## Detailed Description

Logging features.

This file specifies aubio_log_set_function and aubio_log_set_level_function, which let you define one or several custom logging functions to redirect warnings and errors from aubio to your application. The custom function should have the prototype defined in aubio_log_function_t.

After a call to aubio_log_set_level_function, aubio_log_reset can be used to reset each logging functions to the default ones.

Definition in file log.h.

## Typedef Documentation

## ◆ aubio_log_function_t

typedef void(* aubio_log_function_t) (sint_t level, const char_t *message, void *data)

Logging function prototype, to be passed to aubio_log_set_function.

Parameters

  level | log level
  message | text to log
  data | optional closure used by the callback

See utils/test-log.c for an example of logging function.

Definition at line 64 of file log.h.

## Enumeration Type Documentation

## ◆ aubio_log_level

enum aubio_log_level

list of logging levels

Enumerator
AUBIO_LOG_ERR | critical errors
AUBIO_LOG_INF | infos
AUBIO_LOG_MSG | general messages
AUBIO_LOG_DBG | debug messages
AUBIO_LOG_WRN | warnings
AUBIO_LOG_LAST_LEVEL | number of valid levels

Definition at line 46 of file log.h.

## Function Documentation

## ◆ aubio_log_reset()

void aubio_log_reset | ( | void |  | ) |

Reset all logging functions to the default one.

After calling this function, the default logging function will be used to print error, warning, normal, and debug messages to `stdout` or `stderr`.

Examples
  utils/test-log.c.

## ◆ aubio_log_set_function()

void aubio_log_set_function | ( | aubio_log_function_t | fun,
|  | void * | data )

Set logging function for all levels.

Parameters

  fun | the function to be used to log, of type aubio_log_function_t
  data | optional closure to be passed to the function (can be NULL if nothing to pass)

Examples
  utils/test-log.c.

## ◆ aubio_log_set_level_function()

aubio_log_function_t aubio_log_set_level_function | ( | sint_t | level,
|  | aubio_log_function_t | fun,
|  | void * | data )

Set logging function for a given level.

Parameters

  level | the level for which to set the logging function
  fun | the function to be used to log, of type aubio_log_function_t
  data | optional closure to be passed to the function (can be NULL if nothing to pass)

Examples
  utils/test-log.c.