summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-08-28 00:42:59 +0300
committerRan Benita <ran234@gmail.com>2012-09-03 10:31:12 +0300
commit8d7d9792d1e97abf09d6b93605884590e02f346e (patch)
treeaeaa5d5e8d54657d72236602e001823f65663496 /test
parent95d4fb9e4bc815d39a974deaee5373254e134f93 (diff)
downloadlibxkbcommon-8d7d9792d1e97abf09d6b93605884590e02f346e.tar.gz
libxkbcommon-8d7d9792d1e97abf09d6b93605884590e02f346e.tar.bz2
libxkbcommon-8d7d9792d1e97abf09d6b93605884590e02f346e.zip
log: replace "priority" by "level" everywhere
Now that we don't use syslog, "level" does sound more commonplace. We should change it while there is still nobody using it. Also leave some space between the integers of the xkb_log_level enum values, if we ever need to shove more in between. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/common.c2
-rw-r--r--test/log.c22
-rw-r--r--test/rulescomp.c6
3 files changed, 17 insertions, 13 deletions
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;