summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/context.c50
-rw-r--r--src/xkb-priv.h40
-rw-r--r--src/xkbcomp/include.c2
-rw-r--r--src/xkbcomp/keycodes.c4
-rw-r--r--src/xkbcomp/scanner.l2
-rw-r--r--src/xkbcomp/symbols.c16
-rw-r--r--src/xkbcomp/types.c18
-rw-r--r--test/common.c2
-rw-r--r--test/log.c22
-rw-r--r--test/rulescomp.c6
-rw-r--r--xkbcommon/xkbcommon.h27
11 files changed, 99 insertions, 90 deletions
diff --git a/src/context.c b/src/context.c
index 6c52d37..b16b803 100644
--- a/src/context.c
+++ b/src/context.c
@@ -176,9 +176,9 @@ xkb_context_unref(struct xkb_context *ctx)
}
static const char *
-priority_to_prefix(int priority)
+log_level_to_prefix(enum xkb_log_level level)
{
- switch (priority) {
+ switch (level) {
case XKB_LOG_LEVEL_DEBUG:
return "Debug:";
case XKB_LOG_LEVEL_INFO:
@@ -188,39 +188,41 @@ priority_to_prefix(int priority)
case XKB_LOG_LEVEL_ERROR:
return "Error:";
case XKB_LOG_LEVEL_CRITICAL:
- return "Internal error (critical):";
+ return "Critical:";
default:
return NULL;
}
}
ATTR_PRINTF(3, 0) static void
-default_log_fn(struct xkb_context *ctx, int priority,
+default_log_fn(struct xkb_context *ctx, enum xkb_log_level level,
const char *fmt, va_list args)
{
- const char *prefix = priority_to_prefix(priority);
+ const char *prefix = log_level_to_prefix(level);
if (prefix)
fprintf(stderr, "%-10s", prefix);
vfprintf(stderr, fmt, args);
}
-static int
-log_priority(const char *priority) {
+static enum xkb_log_level
+log_level(const char *level) {
char *endptr;
- int prio;
+ enum xkb_log_level lvl;
errno = 0;
- prio = strtol(priority, &endptr, 10);
+ lvl = strtol(level, &endptr, 10);
if (errno == 0 && (endptr[0] == '\0' || isspace(endptr[0])))
- return prio;
- if (strncasecmp(priority, "err", 3) == 0)
+ return lvl;
+ if (istreq_prefix("crit", level))
+ return XKB_LOG_LEVEL_CRITICAL;
+ if (istreq_prefix("err", level))
return XKB_LOG_LEVEL_ERROR;
- if (strncasecmp(priority, "warn", 4) == 0)
+ if (istreq_prefix("warn", level))
return XKB_LOG_LEVEL_WARNING;
- if (strncasecmp(priority, "info", 4) == 0)
+ if (istreq_prefix("info", level))
return XKB_LOG_LEVEL_INFO;
- if (strncasecmp(priority, "debug", 5) == 0)
+ if (istreq_prefix("debug", level) || istreq_prefix("dbg", level))
return XKB_LOG_LEVEL_DEBUG;
return XKB_LOG_LEVEL_ERROR;
@@ -253,13 +255,13 @@ xkb_context_new(enum xkb_context_flags flags)
ctx->refcnt = 1;
ctx->log_fn = default_log_fn;
- ctx->log_priority = XKB_LOG_LEVEL_ERROR;
+ ctx->log_level = XKB_LOG_LEVEL_ERROR;
ctx->log_verbosity = 0;
/* Environment overwrites defaults. */
env = getenv("XKB_LOG");
if (env)
- xkb_set_log_priority(ctx, log_priority(env));
+ xkb_set_log_level(ctx, log_level(env));
env = getenv("XKB_VERBOSITY");
if (env)
@@ -307,33 +309,35 @@ xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom)
}
void
-xkb_log(struct xkb_context *ctx, int priority, const char *fmt, ...)
+xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
+ const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- ctx->log_fn(ctx, priority, fmt, args);
+ ctx->log_fn(ctx, level, fmt, args);
va_end(args);
}
XKB_EXPORT void
xkb_set_log_fn(struct xkb_context *ctx,
- void (*log_fn)(struct xkb_context *ctx, int priority,
+ void (*log_fn)(struct xkb_context *ctx,
+ enum xkb_log_level level,
const char *fmt, va_list args))
{
ctx->log_fn = (log_fn ? log_fn : default_log_fn);
}
XKB_EXPORT enum xkb_log_level
-xkb_get_log_priority(struct xkb_context *ctx)
+xkb_get_log_level(struct xkb_context *ctx)
{
- return ctx->log_priority;
+ return ctx->log_level;
}
XKB_EXPORT void
-xkb_set_log_priority(struct xkb_context *ctx, enum xkb_log_level priority)
+xkb_set_log_level(struct xkb_context *ctx, enum xkb_log_level level)
{
- ctx->log_priority = priority;
+ ctx->log_level = level;
}
XKB_EXPORT int
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 2a55baf..3e7fb16 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -98,9 +98,10 @@ typedef uint32_t xkb_atom_t;
struct xkb_context {
int refcnt;
- ATTR_PRINTF(3, 0) void (*log_fn)(struct xkb_context *ctx, int priority,
+ ATTR_PRINTF(3, 0) void (*log_fn)(struct xkb_context *ctx,
+ enum xkb_log_level level,
const char *fmt, va_list args);
- enum xkb_log_level log_priority;
+ enum xkb_log_level log_level;
int log_verbosity;
void *user_data;
@@ -464,19 +465,18 @@ bool
xkb_keysym_is_keypad(xkb_keysym_t keysym);
ATTR_PRINTF(3, 4) void
-xkb_log(struct xkb_context *ctx, int priority, const char *fmt, ...);
+xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
+ const char *fmt, ...);
-#define xkb_log_cond(ctx, prio, ...) \
- do { \
- if (xkb_get_log_priority(ctx) >= (prio)) \
- xkb_log((ctx), (prio), __VA_ARGS__); \
- } while (0)
+#define xkb_log_cond_level(ctx, level, ...) do { \
+ if (xkb_get_log_level(ctx) >= (level)) \
+ xkb_log((ctx), (level), __VA_ARGS__); \
+} while (0)
-#define xkb_log_cond_lvl(ctx, prio, lvl, ...) \
- do { \
- if (xkb_get_log_verbosity(ctx) >= (lvl)) \
- xkb_log_cond((ctx), (prio), __VA_ARGS__); \
- } while (0)
+#define xkb_log_cond_verbosity(ctx, level, vrb, ...) do { \
+ if (xkb_get_log_verbosity(ctx) >= (vrb)) \
+ xkb_log_cond_level((ctx), (level), __VA_ARGS__); \
+} while (0)
/*
* The format is not part of the argument list in order to avoid the
@@ -485,16 +485,16 @@ xkb_log(struct xkb_context *ctx, int priority, const char *fmt, ...);
* result in an error, though.
*/
#define log_dbg(ctx, ...) \
- xkb_log_cond((ctx), XKB_LOG_LEVEL_DEBUG, __VA_ARGS__)
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_DEBUG, __VA_ARGS__)
#define log_info(ctx, ...) \
- xkb_log_cond((ctx), XKB_LOG_LEVEL_INFO, __VA_ARGS__)
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_INFO, __VA_ARGS__)
#define log_warn(ctx, ...) \
- xkb_log_cond((ctx), XKB_LOG_LEVEL_WARNING, __VA_ARGS__)
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_WARNING, __VA_ARGS__)
#define log_err(ctx, ...) \
- xkb_log_cond((ctx), XKB_LOG_LEVEL_ERROR, __VA_ARGS__)
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_ERROR, __VA_ARGS__)
#define log_wsgo(ctx, ...) \
- xkb_log_cond((ctx), XKB_LOG_LEVEL_CRITICAL, __VA_ARGS__)
-#define log_lvl(ctx, lvl, ...) \
- xkb_log_cond_lvl((ctx), XKB_LOG_LEVEL_WARNING, (lvl), __VA_ARGS__)
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define log_vrb(ctx, vrb, ...) \
+ xkb_log_cond_verbosity((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__)
#endif /* XKB_PRIV_H */
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index 3599602..692da56 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -250,7 +250,7 @@ ProcessIncludeFile(struct xkb_context *ctx,
}
}
else if (rtrn->common.next) {
- log_lvl(ctx, 5,
+ log_vrb(ctx, 5,
"No map in include statement, but \"%s\" contains several; "
"Using first defined map, \"%s\"\n",
stmt->file, rtrn->name);
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 872f671..49d07a6 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -755,7 +755,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
/* Check that ->real is a key. */
key = FindNamedKey(keymap, alias->real, false, 0);
if (!key) {
- log_lvl(info->ctx, 5,
+ log_vrb(info->ctx, 5,
"Attempt to alias %s to non-existent key %s; Ignored\n",
LongKeyNameText(alias->alias),
LongKeyNameText(alias->real));
@@ -765,7 +765,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
/* Check that ->alias is not a key. */
key = FindNamedKey(keymap, alias->alias, false, 0);
if (key) {
- log_lvl(info->ctx, 5,
+ log_vrb(info->ctx, 5,
"Attempt to create alias with the name of a real key; "
"Alias \"%s = %s\" ignored\n",
LongKeyNameText(alias->alias),
diff --git a/src/xkbcomp/scanner.l b/src/xkbcomp/scanner.l
index 6dfa28b..b29b711 100644
--- a/src/xkbcomp/scanner.l
+++ b/src/xkbcomp/scanner.l
@@ -242,7 +242,7 @@ CheckDefaultMap(struct xkb_context *ctx, XkbFile *maps, const char *fileName)
continue;
}
- log_lvl(ctx, 3,
+ log_vrb(ctx, 3,
"Multiple default components in %s; "
"Using %s, ignoring %s\n",
(fileName ? fileName : "(unknown)"),
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 09def70..b245201 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1033,7 +1033,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
const char *str;
if (!ExprResolveString(ctx, value, &str))
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"The type field of a key symbol map must be a string; "
"Ignoring illegal type definition\n");
@@ -1187,7 +1187,7 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
const char *name;
if (!arrayNdx) {
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"You must specify an index when specifying a group name; "
"Group name definition without array subscript ignored\n");
return false;
@@ -1724,7 +1724,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
key = FindNamedKey(keymap, keyi->name, useAlias, start_from);
if (!key) {
if (start_from == 0)
- log_lvl(info->keymap->ctx, 5,
+ log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; Symbols ignored\n",
LongKeyNameText(keyi->name));
return false;
@@ -1749,7 +1749,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
darray_mem(keyi->syms[i], 0),
&keyi->types[i], &autoType)) { }
else
- log_lvl(info->keymap->ctx, 5,
+ log_vrb(info->keymap->ctx, 5,
"No automatic type for %d symbols; "
"Using %s for the %s key (keycode %d)\n",
keyi->numLevels[i],
@@ -1761,7 +1761,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
key->explicit |= (1 << i);
}
else {
- log_lvl(info->keymap->ctx, 3,
+ log_vrb(info->keymap->ctx, 3,
"Type \"%s\" is not defined; "
"Using default type for the %s key (keycode %d)\n",
xkb_atom_text(keymap->ctx, keyi->types[i]),
@@ -1776,7 +1776,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
/* if the type specifies fewer levels than the key has, shrink the key */
type = &keymap->types[types[i]];
if (type->num_levels < keyi->numLevels[i]) {
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Type \"%s\" has %d levels, but %s has %d symbols; "
"Ignoring extra symbols\n",
xkb_atom_text(keymap->ctx, type->name),
@@ -1875,7 +1875,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
if (!entry->haveSymbol) {
key = FindNamedKey(keymap, entry->u.keyName, true, 0);
if (!key) {
- log_lvl(info->keymap->ctx, 5,
+ log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; "
"Modifier map entry for %s not updated\n",
LongKeyNameText(entry->u.keyName),
@@ -1886,7 +1886,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
else {
key = FindKeyForSymbol(keymap, entry->u.keySym);
if (!key) {
- log_lvl(info->keymap->ctx, 5,
+ log_vrb(info->keymap->ctx, 5,
"Key \"%s\" not found in symbol map; "
"Modifier map entry for %s not updated\n",
KeysymText(entry->u.keySym),
diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c
index d5071d4..fa6da56 100644
--- a/src/xkbcomp/types.c
+++ b/src/xkbcomp/types.c
@@ -276,7 +276,7 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new)
}
if (old->file_id == new->file_id)
- log_lvl(info->keymap->ctx, 4,
+ log_vrb(info->keymap->ctx, 4,
"Multiple definitions of the %s key type; "
"Later definition ignored\n",
xkb_atom_text(info->keymap->ctx, new->name));
@@ -422,7 +422,7 @@ AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type,
(clobber ? old->level : new->level) + 1);
}
else {
- log_lvl(info->keymap->ctx, 10,
+ log_vrb(info->keymap->ctx, 10,
"Multiple occurences of map[%s]= %d in %s; Ignored\n",
MapEntryTxt(info, new), new->level + 1,
TypeTxt(info, type));
@@ -458,7 +458,7 @@ SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
return ReportTypeBadType(info, type, "map entry", "modifier mask");
if (entry.mods.mods & (~type->mods)) {
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Map entry for unused modifiers in %s; "
"Using %s instead of %s\n",
TypeTxt(info, type),
@@ -500,7 +500,7 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
/* Map exists with same preserve; do nothing. */
if (entry->preserve.mods == preserve_mods) {
- log_lvl(info->keymap->ctx, 10,
+ log_vrb(info->keymap->ctx, 10,
"Identical definitions for preserve[%s] in %s; "
"Ignored\n",
VModMaskText(info->keymap, mods),
@@ -509,7 +509,7 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
}
/* Map exists with different preserve; latter wins. */
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Multiple definitions for preserve[%s] in %s; "
"Using %s, ignoring %s\n",
VModMaskText(info->keymap, mods),
@@ -553,7 +553,7 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
mods &= type->mods;
after = VModMaskText(info->keymap, mods);
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Preserve for modifiers not used by the %s type; "
"Index %s converted to %s\n",
TypeTxt(info, type), before, after);
@@ -575,7 +575,7 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
preserve_mods &= mods;
after = VModMaskText(info->keymap, preserve_mods);
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Illegal value for preserve[%s] in type %s; "
"Converted %s to %s\n",
VModMaskText(info->keymap, mods),
@@ -599,7 +599,7 @@ AddLevelName(KeyTypesInfo *info, KeyTypeInfo *type,
/* Same level, same name. */
if (darray_item(type->level_names, level) == name) {
- log_lvl(info->keymap->ctx, 10,
+ log_vrb(info->keymap->ctx, 10,
"Duplicate names for level %d of key type %s; Ignored\n",
level + 1, TypeTxt(info, type));
return true;
@@ -611,7 +611,7 @@ AddLevelName(KeyTypesInfo *info, KeyTypeInfo *type,
old = xkb_atom_text(info->keymap->ctx,
darray_item(type->level_names, level));
new = xkb_atom_text(info->keymap->ctx, name);
- log_lvl(info->keymap->ctx, 1,
+ log_vrb(info->keymap->ctx, 1,
"Multiple names for level %d of key type %s; "
"Using %s, ignoring %s\n",
level + 1, TypeTxt(info, type),
diff --git a/test/common.c b/test/common.c
index 2d49824..351276e 100644
--- a/test/common.c
+++ b/test/common.c
@@ -101,7 +101,7 @@ test_get_context(void)
xkb_context_include_path_append(ctx, test_get_path(""));
- xkb_set_log_priority(ctx, XKB_LOG_LEVEL_DEBUG);
+ xkb_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG);
xkb_set_log_verbosity(ctx, 101);
return ctx;
diff --git a/test/log.c b/test/log.c
index f3e7cee..6f40ec0 100644
--- a/test/log.c
+++ b/test/log.c
@@ -32,9 +32,11 @@
#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
static const char *
-priority_to_string(int priority)
+log_level_to_string(enum xkb_log_level level)
{
- switch (priority) {
+ switch (level) {
+ case XKB_LOG_LEVEL_CRITICAL:
+ return "critical";
case XKB_LOG_LEVEL_ERROR:
return "error";
case XKB_LOG_LEVEL_WARNING:
@@ -49,7 +51,8 @@ priority_to_string(int priority)
}
ATTR_PRINTF(3, 0) static void
-log_fn(struct xkb_context *ctx, int priority, const char *fmt, va_list args)
+log_fn(struct xkb_context *ctx, enum xkb_log_level level,
+ const char *fmt, va_list args)
{
char *s;
int size;
@@ -59,7 +62,7 @@ log_fn(struct xkb_context *ctx, int priority, const char *fmt, va_list args)
size = vasprintf(&s, fmt, args);
assert(size != -1);
- darray_append_string(*ls, priority_to_string(priority));
+ darray_append_string(*ls, log_level_to_string(level));
darray_append_lit(*ls, ": ");
darray_append_string(*ls, s);
free(s);
@@ -73,6 +76,7 @@ main(void)
int ret;
ret = setenv("XKB_LOG", "warn", 1);
+ assert(ret == 0);
ret = setenv("XKB_VERBOSITY", "5", 1);
assert(ret == 0);
ctx = xkb_context_new(0);
@@ -86,22 +90,22 @@ main(void)
log_info(ctx, "first info\n");
log_dbg(ctx, "first debug: %s\n", "hello");
log_err(ctx, "first error: %lu\n", 115415UL);
- log_lvl(ctx, 5, "first verbose 5\n");
+ log_vrb(ctx, 5, "first verbose 5\n");
- xkb_set_log_priority(ctx, XKB_LOG_LEVEL_DEBUG);
+ xkb_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG);
log_warn(ctx, "second warning: %d\n", 87);
log_dbg(ctx, "second debug: %s %s\n", "hello", "world");
log_info(ctx, "second info\n");
log_err(ctx, "second error: %lu\n", 115415UL);
- log_lvl(ctx, 6, "second verbose 6\n");
+ log_vrb(ctx, 6, "second verbose 6\n");
xkb_set_log_verbosity(ctx, 0);
- xkb_set_log_priority(ctx, XKB_LOG_LEVEL_CRITICAL);
+ xkb_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
log_warn(ctx, "third warning: %d\n", 87);
log_dbg(ctx, "third debug: %s %s\n", "hello", "world");
log_info(ctx, "third info\n");
log_err(ctx, "third error: %lu\n", 115415UL);
- log_lvl(ctx, 0, "third verbose 0\n");
+ log_vrb(ctx, 0, "third verbose 0\n");
printf("%s", log_string.item);
diff --git a/test/rulescomp.c b/test/rulescomp.c
index fe17b8d..0d40761 100644
--- a/test/rulescomp.c
+++ b/test/rulescomp.c
@@ -70,11 +70,11 @@ static void
benchmark(struct xkb_context *context)
{
struct timespec start, stop, elapsed;
- enum xkb_log_level old_prio = xkb_get_log_priority(context);
+ enum xkb_log_level old_level = xkb_get_log_level(context);
int old_verb = xkb_get_log_verbosity(context);
int i;
- xkb_set_log_priority(context, XKB_LOG_LEVEL_CRITICAL);
+ xkb_set_log_level(context, XKB_LOG_LEVEL_CRITICAL);
xkb_set_log_verbosity(context, 0);
clock_gettime(CLOCK_MONOTONIC, &start);
@@ -82,7 +82,7 @@ benchmark(struct xkb_context *context)
assert(test_rmlvo_silent(context, "evdev", "evdev", "us", "", ""));
clock_gettime(CLOCK_MONOTONIC, &stop);
- xkb_set_log_priority(context, old_prio);
+ xkb_set_log_level(context, old_level);
xkb_set_log_verbosity(context, old_verb);
elapsed.tv_sec = stop.tv_sec - start.tv_sec;
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index 9fc6c7b..6333f97 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -258,15 +258,15 @@ xkb_context_unref(struct xkb_context *context);
enum xkb_log_level {
/** Log critical internal errors only */
- XKB_LOG_LEVEL_CRITICAL = 0,
+ XKB_LOG_LEVEL_CRITICAL = 10,
/** Log all errors */
- XKB_LOG_LEVEL_ERROR = 1,
+ XKB_LOG_LEVEL_ERROR = 20,
/** Log warnings and errors */
- XKB_LOG_LEVEL_WARNING = 2,
+ XKB_LOG_LEVEL_WARNING = 30,
/** Log information, warnings, and errors */
- XKB_LOG_LEVEL_INFO = 3,
+ XKB_LOG_LEVEL_INFO = 40,
/** Log all the things */
- XKB_LOG_LEVEL_DEBUG = 4,
+ XKB_LOG_LEVEL_DEBUG = 50,
};
/**
@@ -275,23 +275,24 @@ enum xkb_log_level {
**/
void
xkb_set_log_fn(struct xkb_context *context,
- void (*log_fn)(struct xkb_context *context, int priority,
+ void (*log_fn)(struct xkb_context *context,
+ enum xkb_log_level level,
const char *format, va_list args));
/**
- * Sets the current logging priority. The value controls which messages
- * are logged. The default priority is LOG_ERR.
+ * Sets the current logging level. The value controls which messages
+ * are logged. The default level is XKB_LOG_LEVEL_ERROR.
*
* The environment variable XKB_LOG, if set, overrides the default value
- * and may be specified as a priority number or name.
+ * and may be specified as a level number or name.
*/
void
-xkb_set_log_priority(struct xkb_context *context, enum xkb_log_level priority);
+xkb_set_log_level(struct xkb_context *context, enum xkb_log_level level);
/**
- * Returns the current logging priority.
+ * Returns the current logging level.
*/
enum xkb_log_level
-xkb_get_log_priority(struct xkb_context *context);
+xkb_get_log_level(struct xkb_context *context);
/**
* Sets the current logging verbosity, a value from 0 to 10.
@@ -302,7 +303,7 @@ xkb_get_log_priority(struct xkb_context *context);
* The environment variable XKB_VERBOSITY, if set, overrdies the default
* value.
*
- * Note that most verbose messages are of priority XKB_LOG_LEVEL_WARNING
+ * Note that most verbose messages are of level XKB_LOG_LEVEL_WARNING
* or lower.
*/
void