summaryrefslogtreecommitdiffstats
path: root/src/pacman/callback.c
diff options
context:
space:
mode:
authorOlivier Brunel <jjk@jjacky.com>2014-01-10 16:25:15 +0100
committerAllan McRae <allan@archlinux.org>2014-03-03 02:25:54 +0100
commitcd793c5ab7689cc8cbc18277375b368060e5acfe (patch)
treea910fef22528f58f2abb38f89a1df354f8f35d62 /src/pacman/callback.c
parent28dbd5551ee75e843019e6f067ed069daaabba0b (diff)
downloadpacman-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/pacman/callback.c')
-rw-r--r--src/pacman/callback.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 218772d5..cd77a312 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -270,6 +270,24 @@ void cb_event(alpm_event_t *event)
((alpm_event_database_missing_t *) event)->dbname);
}
break;
+ case ALPM_EVENT_LOG:
+ {
+ alpm_event_log_t *e = (alpm_event_log_t *) event;
+ if(!e->fmt || strlen(e->fmt) == 0) {
+ break;
+ }
+
+ if(on_progress) {
+ char *string = NULL;
+ pm_vasprintf(&string, e->level, e->fmt, e->args);
+ if(string != NULL) {
+ output = alpm_list_add(output, string);
+ }
+ } else {
+ pm_vfprintf(stderr, e->level, e->fmt, e->args);
+ }
+ }
+ break;
/* all the simple done events, with fallthrough for each */
case ALPM_EVENT_FILECONFLICTS_DONE:
case ALPM_EVENT_CHECKDEPS_DONE:
@@ -777,22 +795,4 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
return;
}
-/* Callback to handle notifications from the library */
-void cb_log(alpm_loglevel_t level, const char *fmt, va_list args)
-{
- if(!fmt || strlen(fmt) == 0) {
- return;
- }
-
- if(on_progress) {
- char *string = NULL;
- pm_vasprintf(&string, level, fmt, args);
- if(string != NULL) {
- output = alpm_list_add(output, string);
- }
- } else {
- pm_vfprintf(stderr, level, fmt, args);
- }
-}
-
/* vim: set noet: */