[PATCH] Weston logging functionality.

Martin Minarik minarik11 at student.fiit.stuba.sk
Wed May 23 08:21:27 PDT 2012


In compositor, create a fprintf stderr handler for messages
from libwayland.
---
 src/compositor.c |    9 +++++++++
 src/compositor.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 3c1e058..a8966d3 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2796,6 +2796,13 @@ load_module(const char *name, const char *entrypoint, void **handle)
 	return init;
 }
 
+void
+wl_log_fprintf_stderr_handler(const char *message, void * args)
+{
+	va_list *argp = args;
+	vfprintf(stderr, message, *argp);
+}
+
 int main(int argc, char *argv[])
 {
 	struct wl_display *display;
@@ -2845,6 +2852,8 @@ int main(int argc, char *argv[])
 		{ WESTON_OPTION_STRING, "module", 0, &module },
 	};
 
+	wl_log_set_handler_server(wl_log_fprintf_stderr_handler);
+
 	memset(&xkb_names, 0, sizeof(xkb_names));
 
 	argc = parse_options(core_options,
diff --git a/src/compositor.h b/src/compositor.h
index 4a659bc..e396e66 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -647,4 +647,6 @@ backend_init(struct wl_display *display, int argc, char *argv[]);
 int
 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
 
+void wl_log_fprintf_stderr_handler(const char *message, void * args);
+
 #endif
-- 
1.7.5.4



More information about the wayland-devel mailing list