libevdev  1.4
A wrapper library for evdev devices
Typedefs | Enumerations | Functions
Library logging facilities

libevdev provides two methods of logging library-internal messages. More...

Typedefs

typedef void(* libevdev_log_func_t) (enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args)
 Logging function called by library-internal logging. More...
 
typedef void(* libevdev_device_log_func_t) (const struct libevdev *dev, enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args)
 Logging function called by library-internal logging for a specific libevdev context. More...
 

Enumerations

enum  libevdev_log_priority { LIBEVDEV_LOG_ERROR, LIBEVDEV_LOG_INFO, LIBEVDEV_LOG_DEBUG }
 

Functions

void libevdev_set_log_function (libevdev_log_func_t logfunc, void *data)
 Set a printf-style logging handler for library-internal logging. More...
 
void libevdev_set_log_priority (enum libevdev_log_priority priority)
 Define the minimum level to be printed to the log handler. More...
 
enum libevdev_log_priority libevdev_get_log_priority (void)
 Return the current log priority level. More...
 
void libevdev_set_device_log_function (struct libevdev *dev, libevdev_device_log_func_t logfunc, enum libevdev_log_priority priority, void *data)
 Set a printf-style logging handler for library-internal logging for this device context. More...
 

Detailed Description

libevdev provides two methods of logging library-internal messages.

The old method is to provide a global log handler in libevdev_set_log_function(). The new method is to provide a per-context log handler in libevdev_set_device_log_function(). Developers are encouraged to use the per-context logging facilities over the global log handler as it provides access to the libevdev instance that caused a message, and is more flexible when libevdev is used from within a shared library.

If a caller sets both the global log handler and a per-context log handler, each device with a per-context log handler will only invoke that log handler.

Note
To set a context-specific log handler, a context is needed. Thus developers are discouraged from using libevdev_new_from_fd() as important messages from the device initialization process may get lost.
A context-specific handler cannot be used for libevdev's uinput devices. uinput device creation must use the global log handler.

Typedef Documentation

typedef void(* libevdev_device_log_func_t) (const struct libevdev *dev, enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args)

Logging function called by library-internal logging for a specific libevdev context.

This function is expected to treat its input like printf would.

Parameters
devThe evdev device
priorityLog priority of this message
dataUser-supplied data pointer (see libevdev_set_log_function())
filelibevdev source code file generating this message
linelibevdev source code line generating this message
funclibevdev source code function generating this message
formatprintf-style format string
argsList of arguments
See also
libevdev_set_log_function
Since
1.3
typedef void(* libevdev_log_func_t) (enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args)

Logging function called by library-internal logging.

This function is expected to treat its input like printf would.

Parameters
priorityLog priority of this message
dataUser-supplied data pointer (see libevdev_set_log_function())
filelibevdev source code file generating this message
linelibevdev source code line generating this message
funclibevdev source code function generating this message
formatprintf-style format string
argsList of arguments
See also
libevdev_set_log_function

Enumeration Type Documentation

Enumerator
LIBEVDEV_LOG_ERROR 

critical errors and application bugs

LIBEVDEV_LOG_INFO 

informational messages

LIBEVDEV_LOG_DEBUG 

debug information

Function Documentation

enum libevdev_log_priority libevdev_get_log_priority ( void  )

Return the current log priority level.

Messages higher than this level are printed, others are discarded. This is a global setting.

Returns
the current log level
Deprecated:
Use per-context logging instead, see libevdev_set_device_log_function().
void libevdev_set_device_log_function ( struct libevdev *  dev,
libevdev_device_log_func_t  logfunc,
enum libevdev_log_priority  priority,
void *  data 
)

Set a printf-style logging handler for library-internal logging for this device context.

The default logging function is NULL, i.e. the global log handler is invoked. If a context-specific log handler is set, the global log handler is not invoked for this device.

Note
This log function applies for this device context only, even if another context exists for the same fd.
Parameters
devThe evdev device
logfuncThe logging function for this device. If NULL, the current logging function is unset and logging falls back to the global log handler, if any.
priorityMinimum priority to be printed to the log.
dataUser-specific data passed to the log handler.
Note
This function may be called before libevdev_set_fd().
Since
1.3
void libevdev_set_log_function ( libevdev_log_func_t  logfunc,
void *  data 
)

Set a printf-style logging handler for library-internal logging.

The default logging function is to stdout.

Note
The global log handler is only called if no context-specific log handler has been set with libevdev_set_device_log_function().
Parameters
logfuncThe logging function for this device. If NULL, the current logging function is unset and no logging is performed.
dataUser-specific data passed to the log handler.
Note
This function may be called before libevdev_set_fd().
Deprecated:
Use per-context logging instead, see libevdev_set_device_log_function().
void libevdev_set_log_priority ( enum libevdev_log_priority  priority)

Define the minimum level to be printed to the log handler.

Messages higher than this level are printed, others are discarded. This is a global setting and applies to any future logging messages.

Parameters
priorityMinimum priority to be printed to the log.
Deprecated:
Use per-context logging instead, see libevdev_set_device_log_function().