|
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.
|
|
The API to control logging output.
◆ 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
-
ei | The EI context |
priority | The log priority |
message | The log message as a null-terminated string |
context | A log message context for this message |
◆ ei_log_priority
Enumerator |
---|
EI_LOG_PRIORITY_DEBUG | |
EI_LOG_PRIORITY_INFO | |
EI_LOG_PRIORITY_WARNING | |
EI_LOG_PRIORITY_ERROR | |
◆ 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()
◆ ei_log_set_handler()
Change the log handler for this context.
If the log handler is NULL, the built-in default log function is used.
- Parameters
-
ei | The EI context |
log_handler | The log handler or NULL to use the default log handler. |
◆ ei_log_set_priority()