libweston: Rename weston_debug_scope_ to weston_log_scope_

Rename also the functions which work on weston_log_scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 6 years ago committed by Daniel Stone
parent 5d5e335845
commit 7e4db95373
  1. 36
      compositor/main.c
  2. 14
      libweston/compositor-drm.c
  3. 10
      libweston/compositor.c
  4. 50
      libweston/weston-debug.c
  5. 16
      libweston/weston-debug.h
  6. 10
      xwayland/launcher.c
  7. 12
      xwayland/window-manager.c

@ -163,10 +163,10 @@ custom_handler(const char *fmt, va_list arg)
vfprintf(weston_logfile, fmt, arg2);
va_end(arg2);
weston_debug_scope_printf(log_scope, "%s libwayland: ",
weston_debug_scope_timestamp(log_scope,
weston_log_scope_printf(log_scope, "%s libwayland: ",
weston_log_scope_timestamp(log_scope,
timestr, sizeof timestr));
weston_debug_scope_vprintf(log_scope, fmt, arg);
weston_log_scope_vprintf(log_scope, fmt, arg);
}
static void
@ -203,11 +203,11 @@ vlog(const char *fmt, va_list ap)
va_copy(ap2, ap);
if (weston_debug_scope_is_enabled(log_scope)) {
weston_debug_scope_printf(log_scope, "%s ",
weston_debug_scope_timestamp(log_scope,
if (weston_log_scope_is_enabled(log_scope)) {
weston_log_scope_printf(log_scope, "%s ",
weston_log_scope_timestamp(log_scope,
timestr, sizeof timestr));
weston_debug_scope_vprintf(log_scope, fmt, ap);
weston_log_scope_vprintf(log_scope, fmt, ap);
}
l = weston_log_timestamp();
@ -223,7 +223,7 @@ vlog_continue(const char *fmt, va_list argp)
va_list argp2;
va_copy(argp2, argp);
weston_debug_scope_vprintf(log_scope, fmt, argp2);
weston_log_scope_vprintf(log_scope, fmt, argp2);
va_end(argp2);
return vfprintf(weston_logfile, fmt, argp);
@ -264,14 +264,14 @@ protocol_log_fn(void *user_data,
int i;
char type;
if (!weston_debug_scope_is_enabled(protocol_scope))
if (!weston_log_scope_is_enabled(protocol_scope))
return;
fp = open_memstream(&logstr, &logsize);
if (!fp)
return;
weston_debug_scope_timestamp(protocol_scope,
weston_log_scope_timestamp(protocol_scope,
timestr, sizeof timestr);
fprintf(fp, "%s ", timestr);
fprintf(fp, "client %p %s ", wl_resource_get_client(res),
@ -334,7 +334,7 @@ protocol_log_fn(void *user_data,
fprintf(fp, ")\n");
if (fclose(fp) == 0)
weston_debug_scope_write(protocol_scope, logstr, logsize);
weston_log_scope_write(protocol_scope, logstr, logsize);
free(logstr);
}
@ -3039,13 +3039,13 @@ int main(int argc, char *argv[])
}
segv_compositor = wet.compositor;
log_scope = weston_compositor_add_debug_scope(log_ctx, "log",
log_scope = weston_compositor_add_log_scope(log_ctx, "log",
"Weston and Wayland log\n", NULL, NULL);
protocol_scope =
weston_compositor_add_debug_scope(log_ctx,
"proto",
"Wayland protocol dump for all clients.\n",
NULL, NULL);
weston_compositor_add_log_scope(log_ctx,
"proto",
"Wayland protocol dump for all clients.\n",
NULL, NULL);
if (debug_protocol) {
protologger = wl_display_add_protocol_logger(display,
@ -3167,9 +3167,9 @@ out:
if (protologger)
wl_protocol_logger_destroy(protologger);
weston_debug_scope_destroy(protocol_scope);
weston_compositor_log_scope_destroy(protocol_scope);
protocol_scope = NULL;
weston_debug_scope_destroy(log_scope);
weston_compositor_log_scope_destroy(log_scope);
log_scope = NULL;
weston_compositor_destroy(wet.compositor);

@ -114,7 +114,7 @@
* possible type and use a matching format specifier.
*/
#define drm_debug(b, ...) \
weston_debug_scope_printf((b)->debug, __VA_ARGS__)
weston_log_scope_printf((b)->debug, __VA_ARGS__)
#define MAX_CLONED_CONNECTORS 4
@ -3199,7 +3199,7 @@ drm_repaint_begin(struct weston_compositor *compositor)
ret = drm_pending_state_alloc(b);
b->repaint_data = ret;
if (weston_debug_scope_is_enabled(b->debug)) {
if (weston_log_scope_is_enabled(b->debug)) {
char *dbg = weston_compositor_print_scene_graph(compositor);
drm_debug(b, "[repaint] Beginning repaint; pending_state %p\n",
ret);
@ -6769,7 +6769,7 @@ drm_destroy(struct weston_compositor *ec)
destroy_sprites(b);
weston_debug_scope_destroy(b->debug);
weston_compositor_log_scope_destroy(b->debug);
b->debug = NULL;
weston_compositor_shutdown(ec);
@ -7499,10 +7499,10 @@ drm_backend_create(struct weston_compositor *compositor,
b->pageflip_timeout = config->pageflip_timeout;
b->use_pixman_shadow = config->use_pixman_shadow;
b->debug = weston_compositor_add_debug_scope(compositor->weston_log_ctx,
"drm-backend",
"Debug messages from DRM/KMS backend\n",
NULL, NULL);
b->debug = weston_compositor_add_log_scope(compositor->weston_log_ctx,
"drm-backend",
"Debug messages from DRM/KMS backend\n",
NULL, NULL);
compositor->backend = &b->base;

@ -6889,10 +6889,10 @@ weston_compositor_create(struct wl_display *display,
timeline_key_binding_handler, ec);
ec->debug_scene =
weston_compositor_add_debug_scope(ec->weston_log_ctx, "scene-graph",
"Scene graph details\n",
debug_scene_graph_cb,
ec);
weston_compositor_add_log_scope(ec->weston_log_ctx, "scene-graph",
"Scene graph details\n",
debug_scene_graph_cb,
ec);
return ec;
@ -7194,7 +7194,7 @@ weston_compositor_destroy(struct weston_compositor *compositor)
if (compositor->heads_changed_source)
wl_event_source_remove(compositor->heads_changed_source);
weston_debug_scope_destroy(compositor->debug_scene);
weston_compositor_log_scope_destroy(compositor->debug_scene);
compositor->debug_scene = NULL;
weston_log_ctx_compositor_destroy(compositor);

@ -54,8 +54,8 @@ struct weston_log_context {
/** weston-log message scope
*
* This is used for scoping debugging messages. Clients can subscribe to
* only the scopes they are interested in. A scope is identified by its name
* This is used for scoping logging/debugging messages. Clients can subscribe
* to only the scopes they are interested in. A scope is identified by its name
* (also referred to as debug stream name).
*/
struct weston_log_scope {
@ -371,7 +371,7 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc)
return wc->weston_log_ctx->global != NULL;
}
/** Register a new debug stream name, creating a debug scope
/** Register a new debug stream name, creating a log scope
*
* \param log_ctx The weston_log_context where to add.
* \param name The debug stream/scope name; must not be NULL.
@ -406,11 +406,11 @@ weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc)
* \sa weston_debug_stream, weston_log_scope_cb
*/
WL_EXPORT struct weston_log_scope *
weston_compositor_add_debug_scope(struct weston_log_context *log_ctx,
const char *name,
const char *description,
weston_log_scope_cb begin_cb,
void *user_data)
weston_compositor_add_log_scope(struct weston_log_context *log_ctx,
const char *name,
const char *description,
weston_log_scope_cb begin_cb,
void *user_data)
{
struct weston_log_scope *scope;
@ -468,7 +468,7 @@ weston_compositor_add_debug_scope(struct weston_log_context *log_ctx,
* \memberof weston_log_scope
*/
WL_EXPORT void
weston_debug_scope_destroy(struct weston_log_scope *scope)
weston_compositor_log_scope_destroy(struct weston_log_scope *scope)
{
struct weston_debug_stream *stream;
@ -490,7 +490,7 @@ weston_debug_scope_destroy(struct weston_log_scope *scope)
/** Are there any active subscriptions to the scope?
*
* \param scope The debug scope to check; may be NULL.
* \param scope The log scope to check; may be NULL.
* \return True if any streams are open for this scope, false otherwise.
*
* As printing some debugging messages may be relatively expensive, one
@ -510,7 +510,7 @@ weston_debug_scope_destroy(struct weston_log_scope *scope)
* \memberof weston_log_scope
*/
WL_EXPORT bool
weston_debug_scope_is_enabled(struct weston_log_scope *scope)
weston_log_scope_is_enabled(struct weston_log_scope *scope)
{
if (!scope)
return false;
@ -626,7 +626,7 @@ weston_debug_stream_complete(struct weston_debug_stream *stream)
weston_debug_stream_v1_send_complete(stream->resource);
}
/** Write debug data for a scope
/** Write log data for a scope
*
* \param scope The debug scope to write for; may be NULL, in which case
* nothing will be written.
@ -641,8 +641,8 @@ weston_debug_stream_complete(struct weston_debug_stream *stream)
* \memberof weston_log_scope
*/
WL_EXPORT void
weston_debug_scope_write(struct weston_log_scope *scope,
const char *data, size_t len)
weston_log_scope_write(struct weston_log_scope *scope,
const char *data, size_t len)
{
struct weston_debug_stream *stream;
@ -655,7 +655,7 @@ weston_debug_scope_write(struct weston_log_scope *scope,
/** Write a formatted string for a scope (varargs)
*
* \param scope The debug scope to write for; may be NULL, in which case
* \param scope The log scope to write for; may be NULL, in which case
* nothing will be written.
* \param fmt Printf-style format string.
* \param ap Formatting arguments.
@ -668,28 +668,28 @@ weston_debug_scope_write(struct weston_log_scope *scope,
* \memberof weston_log_scope
*/
WL_EXPORT void
weston_debug_scope_vprintf(struct weston_log_scope *scope,
const char *fmt, va_list ap)
weston_log_scope_vprintf(struct weston_log_scope *scope,
const char *fmt, va_list ap)
{
static const char oom[] = "Out of memory";
char *str;
int len;
if (!weston_debug_scope_is_enabled(scope))
if (!weston_log_scope_is_enabled(scope))
return;
len = vasprintf(&str, fmt, ap);
if (len >= 0) {
weston_debug_scope_write(scope, str, len);
weston_log_scope_write(scope, str, len);
free(str);
} else {
weston_debug_scope_write(scope, oom, sizeof oom - 1);
weston_log_scope_write(scope, oom, sizeof oom - 1);
}
}
/** Write a formatted string for a scope
*
* \param scope The debug scope to write for; may be NULL, in which case
* \param scope The log scope to write for; may be NULL, in which case
* nothing will be written.
* \param fmt Printf-style format string and arguments.
*
@ -701,13 +701,13 @@ weston_debug_scope_vprintf(struct weston_log_scope *scope,
* \memberof weston_log_scope
*/
WL_EXPORT void
weston_debug_scope_printf(struct weston_log_scope *scope,
weston_log_scope_printf(struct weston_log_scope *scope,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
weston_debug_scope_vprintf(scope, fmt, ap);
weston_log_scope_vprintf(scope, fmt, ap);
va_end(ap);
}
@ -723,8 +723,8 @@ weston_debug_scope_printf(struct weston_log_scope *scope,
* The string is NUL-terminated, even if truncated.
*/
WL_EXPORT char *
weston_debug_scope_timestamp(struct weston_log_scope *scope,
char *buf, size_t len)
weston_log_scope_timestamp(struct weston_log_scope *scope,
char *buf, size_t len)
{
struct timeval tv;
struct tm *bdt;

@ -51,7 +51,7 @@ struct weston_debug_stream;
*
* \param stream The debug stream.
* \param user_data The \c user_data argument given to
* weston_compositor_add_debug_scope()
* weston_compositor_add_log_scope()
*
* \memberof weston_log_scope
* \sa weston_debug_stream
@ -60,28 +60,28 @@ typedef void (*weston_log_scope_cb)(struct weston_debug_stream *stream,
void *user_data);
struct weston_log_scope *
weston_compositor_add_debug_scope(struct weston_log_context *compositor,
weston_compositor_add_log_scope(struct weston_log_context *compositor,
const char *name,
const char *description,
weston_log_scope_cb begin_cb,
void *user_data);
void
weston_debug_scope_destroy(struct weston_log_scope *scope);
weston_compositor_log_scope_destroy(struct weston_log_scope *scope);
bool
weston_debug_scope_is_enabled(struct weston_log_scope *scope);
weston_log_scope_is_enabled(struct weston_log_scope *scope);
void
weston_debug_scope_write(struct weston_log_scope *scope,
weston_log_scope_write(struct weston_log_scope *scope,
const char *data, size_t len);
void
weston_debug_scope_vprintf(struct weston_log_scope *scope,
weston_log_scope_vprintf(struct weston_log_scope *scope,
const char *fmt, va_list ap);
void
weston_debug_scope_printf(struct weston_log_scope *scope,
weston_log_scope_printf(struct weston_log_scope *scope,
const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
@ -102,7 +102,7 @@ void
weston_debug_stream_complete(struct weston_debug_stream *stream);
char *
weston_debug_scope_timestamp(struct weston_log_scope *scope,
weston_log_scope_timestamp(struct weston_log_scope *scope,
char *buf, size_t len);
#ifdef __cplusplus

@ -230,7 +230,7 @@ weston_xserver_destroy(struct wl_listener *l, void *data)
if (wxs->loop)
weston_xserver_shutdown(wxs);
weston_debug_scope_destroy(wxs->wm_debug);
weston_compositor_log_scope_destroy(wxs->wm_debug);
free(wxs);
}
@ -395,10 +395,10 @@ weston_module_init(struct weston_compositor *compositor)
wl_signal_add(&compositor->destroy_signal, &wxs->destroy_listener);
wxs->wm_debug =
weston_compositor_add_debug_scope(wxs->compositor->weston_log_ctx,
"xwm-wm-x11",
"XWM's window management X11 events\n",
NULL, NULL);
weston_compositor_add_log_scope(wxs->compositor->weston_log_ctx,
"xwm-wm-x11",
"XWM's window management X11 events\n",
NULL, NULL);
return 0;
}

@ -196,7 +196,7 @@ xserver_map_shell_surface(struct weston_wm_window *window,
static bool
wm_debug_is_enabled(struct weston_wm *wm)
{
return weston_debug_scope_is_enabled(wm->server->wm_debug);
return weston_log_scope_is_enabled(wm->server->wm_debug);
}
static void __attribute__ ((format (printf, 2, 3)))
@ -206,12 +206,12 @@ wm_printf(struct weston_wm *wm, const char *fmt, ...)
char timestr[128];
if (wm_debug_is_enabled(wm))
weston_debug_scope_printf(wm->server->wm_debug, "%s ",
weston_debug_scope_timestamp(wm->server->wm_debug,
weston_log_scope_printf(wm->server->wm_debug, "%s ",
weston_log_scope_timestamp(wm->server->wm_debug,
timestr, sizeof timestr));
va_start(ap, fmt);
weston_debug_scope_vprintf(wm->server->wm_debug, fmt, ap);
weston_log_scope_vprintf(wm->server->wm_debug, fmt, ap);
va_end(ap);
}
static void
@ -1379,7 +1379,7 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
if (fp) {
fprintf(fp, "%s XCB_PROPERTY_NOTIFY: window %d, ",
weston_debug_scope_timestamp(wm->server->wm_debug,
weston_log_scope_timestamp(wm->server->wm_debug,
timestr, sizeof timestr),
property_notify->window);
if (property_notify->state == XCB_PROPERTY_DELETE)
@ -1390,7 +1390,7 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
property_notify->atom);
if (fclose(fp) == 0)
weston_debug_scope_write(wm->server->wm_debug,
weston_log_scope_write(wm->server->wm_debug,
logstr, logsize);
free(logstr);
} else {

Loading…
Cancel
Save