summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-01-18 20:42:21 -0500
committerAllan McRae <allan@archlinux.org>2013-01-28 23:38:46 +1000
commit66a9b5314123b3632cb90a4d37fd422a0f898568 (patch)
tree689776d6536072ed623813fae6e088969d01498f /src
parent8308c7b320ae230252ff0e79ea18cbfed0d13e81 (diff)
downloadpacman-66a9b5314123b3632cb90a4d37fd422a0f898568.tar.xz
add caller prefix to alpm_logaction
prefix defaults to "UNKOWN" if null or an empty string is provided. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/callback.c24
-rw-r--r--src/pacman/pacman.c3
-rw-r--r--src/pacman/pacman.h2
-rw-r--r--src/pacman/sync.c6
4 files changed, 22 insertions, 13 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index f53f59c8..93418db3 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -31,6 +31,7 @@
#include <alpm.h>
/* pacman */
+#include "pacman.h"
#include "callback.h"
#include "util.h"
#include "conf.h"
@@ -176,9 +177,10 @@ void cb_event(alpm_event_t event, void *data1, void *data2)
}
break;
case ALPM_EVENT_ADD_DONE:
- alpm_logaction(config->handle, "installed %s (%s)\n",
- alpm_pkg_get_name(data1),
- alpm_pkg_get_version(data1));
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "installed %s (%s)\n",
+ alpm_pkg_get_name(data1),
+ alpm_pkg_get_version(data1));
display_optdepends(data1);
break;
case ALPM_EVENT_REMOVE_START:
@@ -187,9 +189,10 @@ void cb_event(alpm_event_t event, void *data1, void *data2)
}
break;
case ALPM_EVENT_REMOVE_DONE:
- alpm_logaction(config->handle, "removed %s (%s)\n",
- alpm_pkg_get_name(data1),
- alpm_pkg_get_version(data1));
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "removed %s (%s)\n",
+ alpm_pkg_get_name(data1),
+ alpm_pkg_get_version(data1));
break;
case ALPM_EVENT_UPGRADE_START:
if(config->noprogressbar) {
@@ -197,10 +200,11 @@ void cb_event(alpm_event_t event, void *data1, void *data2)
}
break;
case ALPM_EVENT_UPGRADE_DONE:
- alpm_logaction(config->handle, "upgraded %s (%s -> %s)\n",
- alpm_pkg_get_name(data1),
- alpm_pkg_get_version(data2),
- alpm_pkg_get_version(data1));
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "upgraded %s (%s -> %s)\n",
+ alpm_pkg_get_name(data1),
+ alpm_pkg_get_version(data2),
+ alpm_pkg_get_version(data1));
display_new_optdepends(data2, data1);
break;
case ALPM_EVENT_INTEGRITY_START:
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index f3ca8b97..8448d6b4 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -744,7 +744,8 @@ static void cl_to_log(int argc, char *argv[])
*p++ = ' ';
}
strcpy(p, argv[i]);
- alpm_logaction(config->handle, "Running '%s'\n", cl_text);
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "Running '%s'\n", cl_text);
free(cl_text);
}
diff --git a/src/pacman/pacman.h b/src/pacman/pacman.h
index 4eaf3182..7c9c365c 100644
--- a/src/pacman/pacman.h
+++ b/src/pacman/pacman.h
@@ -22,6 +22,8 @@
#include <alpm_list.h>
+#define PACMAN_CALLER_PREFIX "PACMAN"
+
/* database.c */
int pacman_database(alpm_list_t *targets);
/* deptest.c */
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index fef2940a..3decc40d 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -787,7 +787,8 @@ static int sync_trans(alpm_list_t *targets)
if(config->op_s_upgrade) {
printf(_(":: Starting full system upgrade...\n"));
- alpm_logaction(config->handle, "starting full system upgrade\n");
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "starting full system upgrade\n");
if(alpm_sync_sysupgrade(config->handle, config->op_s_upgrade >= 2) == -1) {
pm_printf(ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle)));
trans_release();
@@ -954,7 +955,8 @@ int pacman_sync(alpm_list_t *targets)
if(config->op_s_sync) {
/* grab a fresh package list */
printf(_(":: Synchronizing package databases...\n"));
- alpm_logaction(config->handle, "synchronizing package lists\n");
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "synchronizing package lists\n");
if(!sync_synctree(config->op_s_sync, sync_dbs)) {
return 1;
}