[PATCH] Weston logging functionality.

Pekka Paalanen ppaalanen at gmail.com
Wed May 23 10:54:57 PDT 2012


On Wed, 23 May 2012 17:21:27 +0200
Martin Minarik <minarik11 at student.fiit.stuba.sk> wrote:

> 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)
> +{

Make this function static, and could call it weston_wl_log_handler
or such. It's not a wayland core library function but a weston
function.

> +	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);

No need for declaration here.

Otherwise looking good.

The Wayland patches we reviewed already in irc, so I'm waiting
for an update. Good job!

Then you could move on to what I actually wished for:
weston writing its logs into a file instead of only stderr.
That way I could print informational messages, too, like
EGL and GL strings, what plugins are loaded, etc.


Thanks!

-- 
Pekka Paalanen
http://www.iki.fi/pq/


More information about the wayland-devel mailing list