diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-01-19 02:42:21 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-01-28 14:38:46 +0100 |
commit | 66a9b5314123b3632cb90a4d37fd422a0f898568 (patch) | |
tree | 689776d6536072ed623813fae6e088969d01498f /lib/libalpm/log.c | |
parent | 8308c7b320ae230252ff0e79ea18cbfed0d13e81 (diff) | |
download | pacman-66a9b5314123b3632cb90a4d37fd422a0f898568.tar.gz pacman-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 'lib/libalpm/log.c')
-rw-r--r-- | lib/libalpm/log.c | 17 |
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; } |