mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 22:37:42 -04:00
Note that reentrant calls to libevent from logging cbs may fail badly
This commit is contained in:
parent
7bcace2d54
commit
e431bcd686
@ -280,6 +280,10 @@ void event_base_free(struct event_base *);
|
|||||||
#define _EVENT_LOG_MSG 1
|
#define _EVENT_LOG_MSG 1
|
||||||
#define _EVENT_LOG_WARN 2
|
#define _EVENT_LOG_WARN 2
|
||||||
#define _EVENT_LOG_ERR 3
|
#define _EVENT_LOG_ERR 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
A callback function used to intercept Libevent's log messages.
|
||||||
|
*/
|
||||||
typedef void (*event_log_cb)(int severity, const char *msg);
|
typedef void (*event_log_cb)(int severity, const char *msg);
|
||||||
/**
|
/**
|
||||||
Redirect Libevent's log messages.
|
Redirect Libevent's log messages.
|
||||||
@ -287,6 +291,9 @@ typedef void (*event_log_cb)(int severity, const char *msg);
|
|||||||
@param cb a function taking two arguments: an integer severity between
|
@param cb a function taking two arguments: an integer severity between
|
||||||
_EVENT_LOG_DEBUG and _EVENT_LOG_ERR, and a string. If cb is NULL,
|
_EVENT_LOG_DEBUG and _EVENT_LOG_ERR, and a string. If cb is NULL,
|
||||||
then the default log is used.
|
then the default log is used.
|
||||||
|
|
||||||
|
NOTE: The function you provide *must not* call any other libevent
|
||||||
|
functionality. Doing so can produce undefined behavior.
|
||||||
*/
|
*/
|
||||||
void event_set_log_callback(event_log_cb cb);
|
void event_set_log_callback(event_log_cb cb);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user