libxkbcommon 1.7.0
Enumerations | Functions
Logging Handling

Enumerations

enum  xkb_log_level {
  XKB_LOG_LEVEL_CRITICAL = 10 ,
  XKB_LOG_LEVEL_ERROR = 20 ,
  XKB_LOG_LEVEL_WARNING = 30 ,
  XKB_LOG_LEVEL_INFO = 40 ,
  XKB_LOG_LEVEL_DEBUG = 50
}
 

Functions

void xkb_context::xkb_context_set_log_level (struct xkb_context *context, enum xkb_log_level level)
 
enum xkb_log_level xkb_context::xkb_context_get_log_level (struct xkb_context *context)
 
void xkb_context::xkb_context_set_log_verbosity (struct xkb_context *context, int verbosity)
 
int xkb_context::xkb_context_get_log_verbosity (struct xkb_context *context)
 
void xkb_context::xkb_context_set_log_fn (struct xkb_context *context, void(*log_fn)(struct xkb_context *context, enum xkb_log_level level, const char *format, va_list args))
 

Detailed Description

Manipulating how logging from this library is handled.

Enumeration Type Documentation

◆ xkb_log_level

Specifies a logging level.

Enumerator
XKB_LOG_LEVEL_CRITICAL 

Log critical internal errors only.

XKB_LOG_LEVEL_ERROR 

Log all errors.

XKB_LOG_LEVEL_WARNING 

Log warnings and errors.

XKB_LOG_LEVEL_INFO 

Log information, warnings, and errors.

XKB_LOG_LEVEL_DEBUG 

Log everything.

Function Documentation

◆ xkb_context_set_log_level()

void xkb_context_set_log_level ( struct xkb_context * context,
enum xkb_log_level level )

Set the current logging level.

Parameters
contextThe context in which to set the logging level.
levelThe logging level to use. Only messages from this level and below will be logged.

The default level is XKB_LOG_LEVEL_ERROR. The environment variable XKB_LOG_LEVEL, if set in the time the context was created, overrides the default value. It may be specified as a level number or name.

◆ xkb_context_set_log_verbosity()

void xkb_context_set_log_verbosity ( struct xkb_context * context,
int verbosity )

Sets the current logging verbosity.

The library can generate a number of warnings which are not helpful to ordinary users of the library. The verbosity may be increased if more information is desired (e.g. when developing a new keymap).

The default verbosity is 0. The environment variable XKB_LOG_VERBOSITY, if set in the time the context was created, overrides the default value.

Parameters
contextThe context in which to use the set verbosity.
verbosityThe verbosity to use. Currently used values are 1 to 10, higher values being more verbose. 0 would result in no verbose messages being logged.

Most verbose messages are of level XKB_LOG_LEVEL_WARNING or lower.

◆ xkb_context_set_log_fn()

void xkb_context_set_log_fn ( struct xkb_context * context,
void(*)(struct xkb_context *context, enum xkb_log_level level, const char *format, va_list args) log_fn )

Set a custom function to handle logging messages.

Parameters
contextThe context in which to use the set logging function.
log_fnThe function that will be called for logging messages. Passing NULL restores the default function, which logs to stderr.

By default, log messages from this library are printed to stderr. This function allows you to replace the default behavior with a custom handler. The handler is only called with messages which match the current logging level and verbosity settings for the context. level is the logging level of the message. format and args are the same as in the vprintf(3) function.

You may use xkb_context_set_user_data() on the context, and then call xkb_context_get_user_data() from within the logging function to provide it with additional private context.