[PATCH weston v2 2/5] libinput-seat: allow setting libinput log priority in weston

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 22 17:42:40 PDT 2014


On Thu, Apr 17, 2014 at 07:53:23AM -0700, U. Artie Eoff wrote:
> Look for WESTON_LIBINPUT_LOG_PRIORITY environment variable.  If
> it exists then use it to set the libinput log priority.
> Otherwise, don't set the priority and get whatever libinput's
> default priority is.
> 
> Setting WESTON_LIBINPUT_LOG_PRIORITY=0 allows us to log which
> input devices are detected at Weston startup and makes it a
> little more consistent with Weston's original evdev input setup
> log messages... and useful for debugging and testing.
> 
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>

> ---
>  src/libinput-seat.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/libinput-seat.c b/src/libinput-seat.c
> index 99612c4..7aca969 100644
> --- a/src/libinput-seat.c
> +++ b/src/libinput-seat.c
> @@ -262,12 +262,19 @@ int
>  udev_input_init(struct udev_input *input, struct weston_compositor *c, struct udev *udev,
>  		const char *seat_id)
>  {
> +	const char *log_priority = NULL;
> +
>  	memset(input, 0, sizeof *input);
>  
>  	input->compositor = c;
>  
>  	libinput_log_set_handler(&libinput_log_func, NULL);
>  
> +	log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY");
> +	if (log_priority) {
> +		libinput_log_set_priority(strtol(log_priority, NULL, 10));
> +	}
> +

I see this has been merged already, but I think it'd be better to have this
with the semantic names than the numeric values, e.g.
    WESTON_LIBINPUT_LOG_PRIORITY=error 
it's merely a few added strcmps and the result is more copy/paste proof than
pure numbers.

Cheers,
   Peter

>  	input->libinput = libinput_udev_create_for_seat(&libinput_interface, input,
>  							udev, seat_id);
>  	if (!input->libinput) {
> -- 
> 1.8.5.3



More information about the wayland-devel mailing list