diff options
author | Olivier Brunel <jjk@jjacky.com> | 2014-01-10 16:25:15 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-03-03 02:25:54 +0100 |
commit | cd793c5ab7689cc8cbc18277375b368060e5acfe (patch) | |
tree | a910fef22528f58f2abb38f89a1df354f8f35d62 /src/util/testdb.c | |
parent | 28dbd5551ee75e843019e6f067ed069daaabba0b (diff) | |
download | pacman-cd793c5ab7689cc8cbc18277375b368060e5acfe.tar.gz pacman-cd793c5ab7689cc8cbc18277375b368060e5acfe.tar.xz |
Remove log_cb, add ALPM_EVENT_LOG instead
When ALPM emits a log message, it still goes through _alpm_log() but
instead of calling a specific log callback, it goes as an event.
Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/util/testdb.c')
-rw-r--r-- | src/util/testdb.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/util/testdb.c b/src/util/testdb.c index e3b331ab..4d1fd4c8 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -39,16 +39,18 @@ static void cleanup(int signum) exit(signum); } -__attribute__((format(printf, 2, 0))) -static void output_cb(alpm_loglevel_t level, const char *fmt, va_list args) +static void output_cb(alpm_event_log_t *event) { - if(strlen(fmt)) { - switch(level) { + if(event->type != ALPM_EVENT_LOG) { + return; + } + if(strlen(event->fmt)) { + switch(event->level) { case ALPM_LOG_ERROR: printf("error: "); break; case ALPM_LOG_WARNING: printf("warning: "); break; default: return; } - vprintf(fmt, args); + vprintf(event->fmt, event->args); } } @@ -282,7 +284,7 @@ int main(int argc, char *argv[]) } /* let us get log messages from libalpm */ - alpm_option_set_logcb(handle, output_cb); + alpm_option_set_eventcb(handle, (alpm_cb_event) output_cb); if(!dbnames) { errors = check_localdb(); |