Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/log.c
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 /lib/libalpm/log.c
parent8308c7b320ae230252ff0e79ea18cbfed0d13e81 (diff)
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 'lib/libalpm/log.c')
-rw-r--r--lib/libalpm/log.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index 74143fdf..a8639b4c 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -35,10 +35,12 @@
/** A printf-like function for logging.
* @param handle the context handle
+ * @param prefix caller-specific prefix for the log
* @param fmt output format
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *fmt, ...)
+int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix, const
+ char *fmt, ...)
{
int ret;
va_list args;
@@ -62,20 +64,9 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *fmt, ...)
}
va_start(args, fmt);
- ret = _alpm_logaction(handle, fmt, args);
+ ret = _alpm_logaction(handle, prefix, fmt, args);
va_end(args);
- /* TODO We should add a prefix to log strings depending on who called us.
- * If logaction was called by the frontend:
- * USER: <the frontend log>
- * and if called internally:
- * ALPM: <the library log>
- * Moreover, the frontend should be able to choose its prefix
- * (USER by default?):
- * pacman: "PACMAN"
- * kpacman: "KPACMAN"
- * This would allow us to share the log file between several frontends
- * and know who does what */
return ret;
}