libei 1.3.0
A library for Emulated Input

Typedefs

typedef void(* ei_log_handler) (struct ei *ei, enum ei_log_priority priority, const char *message, struct ei_log_context *context)
 The log handler for library logging.
 

Enumerations

enum  ei_log_priority { EI_LOG_PRIORITY_DEBUG , EI_LOG_PRIORITY_INFO , EI_LOG_PRIORITY_WARNING , EI_LOG_PRIORITY_ERROR }
 

Functions

unsigned int ei_log_context_get_line (struct ei_log_context *ctx)
 
const char * ei_log_context_get_file (struct ei_log_context *ctx)
 
const char * ei_log_context_get_func (struct ei_log_context *ctx)
 
void ei_log_set_handler (struct ei *ei, ei_log_handler log_handler)
 Change the log handler for this context.
 
void ei_log_set_priority (struct ei *ei, enum ei_log_priority priority)
 
enum ei_log_priority ei_log_get_priority (const struct ei *ei)
 

Detailed Description

The API to control logging output.

Typedef Documentation

◆ ei_log_handler

typedef void(* ei_log_handler) (struct ei *ei, enum ei_log_priority priority, const char *message, struct ei_log_context *context)

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 ei_log_set_priority().

The context passed to this function contains auxilary information about this log message such as the line number, file name and function name this message occured in. The log context is valid only within the current invocation of the log handler.

Parameters
eiThe EI context
priorityThe log priority
messageThe log message as a null-terminated string
contextA log message context for this message

Enumeration Type Documentation

◆ ei_log_priority

Enumerator
EI_LOG_PRIORITY_DEBUG 
EI_LOG_PRIORITY_INFO 
EI_LOG_PRIORITY_WARNING 
EI_LOG_PRIORITY_ERROR 

Function Documentation

◆ ei_log_context_get_file()

const char * ei_log_context_get_file ( struct ei_log_context * ctx)
Returns
the file name (__FILE__) for a given log message context.

◆ ei_log_context_get_func()

const char * ei_log_context_get_func ( struct ei_log_context * ctx)
Returns
the function name (__func__) for a given log message context.

◆ ei_log_context_get_line()

unsigned int ei_log_context_get_line ( struct ei_log_context * ctx)
Returns
the line number (__LINE__) for a given log message context.

◆ ei_log_get_priority()

enum ei_log_priority ei_log_get_priority ( const struct ei * ei)

◆ ei_log_set_handler()

void ei_log_set_handler ( struct ei * ei,
ei_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
eiThe EI context
log_handlerThe log handler or NULL to use the default log handler.

◆ ei_log_set_priority()

void ei_log_set_priority ( struct ei * ei,
enum ei_log_priority priority )