From 66a9b5314123b3632cb90a4d37fd422a0f898568 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Fri, 18 Jan 2013 20:42:21 -0500 Subject: add caller prefix to alpm_logaction prefix defaults to "UNKOWN" if null or an empty string is provided. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- lib/libalpm/log.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'lib/libalpm/log.c') 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: - * and if called internally: - * ALPM: - * 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; } -- cgit v1.2.3-24-g4f1b