mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-01 10:30:09 +01:00
util: Add logging utilities
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
97a277a9f0
commit
c0af815eae
2 changed files with 33 additions and 0 deletions
|
|
@ -28,8 +28,33 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libinput-util.h"
|
||||
#include "libinput-private.h"
|
||||
|
||||
static FILE *g_log_file = NULL;
|
||||
|
||||
void
|
||||
set_logging_enabled(int enabled)
|
||||
{
|
||||
g_log_file = enabled ? stdout : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
log_info(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (g_log_file) {
|
||||
va_start(ap, format);
|
||||
vfprintf(g_log_file, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
list_init(struct list *list)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@
|
|||
#ifndef LIBINPUT_UTIL_H
|
||||
#define LIBINPUT_UTIL_H
|
||||
|
||||
#include "libinput.h"
|
||||
|
||||
void
|
||||
set_logging_enabled(int enabled);
|
||||
|
||||
void
|
||||
log_info(const char *format, ...);
|
||||
|
||||
/*
|
||||
* This list data structure is a verbatim copy from wayland-util.h from the
|
||||
* Wayland project; except that wl_ prefix has been removed.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue