mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
Merge branch 'main' into 'main'
log: expose wl_debug_handler for custom print debug message See merge request wayland/wayland!466
This commit is contained in:
commit
155096531b
8 changed files with 33 additions and 1 deletions
|
|
@ -1660,7 +1660,7 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
|
|||
fprintf(f, ")%s\n", color ? WL_DEBUG_COLOR_RESET : "");
|
||||
|
||||
if (fclose(f) == 0) {
|
||||
fprintf(stderr, "%s", buffer);
|
||||
wl_debug("%s", buffer);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,6 +319,9 @@ wl_display_read_events(struct wl_display *display);
|
|||
void
|
||||
wl_log_set_handler_client(wl_log_func_t handler);
|
||||
|
||||
void
|
||||
wl_debug_set_handler_client(wl_debug_func_t handler);
|
||||
|
||||
void
|
||||
wl_display_set_max_buffer_size(struct wl_display *display,
|
||||
size_t max_buffer_size);
|
||||
|
|
|
|||
|
|
@ -2834,6 +2834,12 @@ wl_proxy_wrapper_destroy(void *proxy_wrapper)
|
|||
free(wrapper);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_debug_set_handler_client(wl_debug_func_t handler)
|
||||
{
|
||||
wl_debug_handler = handler;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_log_set_handler_client(wl_log_func_t handler)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@ void
|
|||
wl_closure_destroy(struct wl_closure *closure);
|
||||
|
||||
extern wl_log_func_t wl_log_handler;
|
||||
extern wl_debug_func_t wl_debug_handler;
|
||||
|
||||
void wl_debug(const char *fmt, ...);
|
||||
void wl_log(const char *fmt, ...);
|
||||
void wl_abort(const char *fmt, ...);
|
||||
|
||||
|
|
|
|||
|
|
@ -696,6 +696,9 @@ wl_shm_buffer_create(struct wl_client *client,
|
|||
void
|
||||
wl_log_set_handler_server(wl_log_func_t handler);
|
||||
|
||||
void
|
||||
wl_debug_set_handler_server(wl_debug_func_t handler);
|
||||
|
||||
enum wl_protocol_logger_type {
|
||||
WL_PROTOCOL_LOGGER_REQUEST,
|
||||
WL_PROTOCOL_LOGGER_EVENT,
|
||||
|
|
|
|||
|
|
@ -2107,6 +2107,12 @@ wl_resource_create(struct wl_client *client,
|
|||
return resource;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_debug_set_handler_server(wl_debug_func_t handler)
|
||||
{
|
||||
wl_debug_handler = handler;
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_log_set_handler_server(wl_log_func_t handler)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -452,8 +452,19 @@ wl_log_stderr_handler(const char *fmt, va_list arg)
|
|||
vfprintf(stderr, fmt, arg);
|
||||
}
|
||||
|
||||
wl_debug_func_t wl_debug_handler = wl_log_stderr_handler;
|
||||
wl_log_func_t wl_log_handler = wl_log_stderr_handler;
|
||||
|
||||
void
|
||||
wl_debug(const char *fmt, ...)
|
||||
{
|
||||
va_list argp;
|
||||
|
||||
va_start(argp, fmt);
|
||||
wl_debug_handler(fmt, argp);
|
||||
va_end(argp);
|
||||
}
|
||||
|
||||
void
|
||||
wl_log(const char *fmt, ...)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -747,6 +747,7 @@ typedef int (*wl_dispatcher_func_t)(const void *user_data, void *target,
|
|||
* \sa wl_log_set_handler_server
|
||||
*/
|
||||
typedef void (*wl_log_func_t)(const char *fmt, va_list args) WL_PRINTF(1, 0);
|
||||
typedef wl_log_func_t wl_debug_func_t;
|
||||
|
||||
/**
|
||||
* Return value of an iterator function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue