libei: The logging API

libei 1.3.0 A library for Emulated Input

Typedefs | Enumerations | Functions
The logging API
🍦 EIS - The server API

## Typedefs
typedef void(* | eis_log_handler) (struct eis *eis, enum eis_log_priority priority, const char *message, struct eis_log_context *ctx)
| The log handler for library logging.

## Enumerations
enum | eis_log_priority { EIS_LOG_PRIORITY_DEBUG , EIS_LOG_PRIORITY_INFO , EIS_LOG_PRIORITY_WARNING , EIS_LOG_PRIORITY_ERROR }

## Functions
unsigned int | eis_log_context_get_line (struct eis_log_context *ctx)
const char * | eis_log_context_get_file (struct eis_log_context *ctx)
const char * | eis_log_context_get_func (struct eis_log_context *ctx)
void | eis_log_set_handler (struct eis *eis, eis_log_handler log_handler)
| Change the log handler for this context.
void | eis_log_set_priority (struct eis *eis, enum eis_log_priority priority)
enum eis_log_priority | eis_log_get_priority (const struct eis *eis)

## Detailed Description

The API to control logging output.

## Typedef Documentation

## ◆ eis_log_handler

typedef void(* eis_log_handler) (struct eis *eis, enum eis_log_priority priority, const char *message, struct eis_log_context *ctx)

The log handler for library logging.

This handler is only called for messages with a log level equal or greater than than the one set in eis_log_set_priority().

Parameters

  eis | The EIs context
  priority | The log priority
  message | The log message as a null-terminated string
  ctx | A log message context for this message

## Enumeration Type Documentation

## ◆ eis_log_priority

enum eis_log_priority

Enumerator
EIS_LOG_PRIORITY_DEBUG |
EIS_LOG_PRIORITY_INFO |
EIS_LOG_PRIORITY_WARNING |
EIS_LOG_PRIORITY_ERROR |

## Function Documentation

## ◆ eis_log_context_get_file()

const char * eis_log_context_get_file | ( | struct eis_log_context * | ctx | ) |

Returns
  the file name (`__FILE__`) for a given log message context.

## ◆ eis_log_context_get_func()

const char * eis_log_context_get_func | ( | struct eis_log_context * | ctx | ) |

Returns
  the function name (`__func__`) for a given log message context.

## ◆ eis_log_context_get_line()

unsigned int eis_log_context_get_line | ( | struct eis_log_context * | ctx | ) |

Returns
  the line number (`__LINE__`) for a given log message context.

## ◆ eis_log_get_priority()

enum eis_log_priority eis_log_get_priority | ( | const struct eis * | eis | ) |

## ◆ eis_log_set_handler()

void eis_log_set_handler | ( | struct eis * | eis,
|  | eis_log_handler | log_handler )

Change the log handler for this context.

If the log handler is NULL, the built-in default log function is used.

Parameters

  eis | The EIS context
  log_handler | The log handler or NULL to use the default log handler.

## ◆ eis_log_set_priority()

void eis_log_set_priority | ( | struct eis * | eis,
|  | enum eis_log_priority | priority )