Signed-off-by: Andrew Gregory <[email protected]>
---
 lib/libalpm/log.c  | 2 +-
 lib/libalpm/util.c | 6 +++++-
 lib/libalpm/util.h | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index 5c4bf9a..0b48d26 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -62,7 +62,7 @@ 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, handle->program, fmt, args);
        va_end(args);
 
        return ret;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index dda6a92..8a6f27c 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -453,7 +453,8 @@ ssize_t _alpm_files_in_directory(alpm_handle_t *handle, 
const char *path,
  * @return 0 or number of characters written on success, vfprintf return value
  * on error
  */
-int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args)
+int _alpm_logaction(alpm_handle_t *handle, const char *prefix,
+               const char *fmt, va_list args)
 {
        int ret = 0;
 
@@ -477,6 +478,9 @@ int _alpm_logaction(alpm_handle_t *handle, const char *fmt, 
va_list args)
                fprintf(handle->logstream, "[%04d-%02d-%02d %02d:%02d] ",
                                                tm->tm_year+1900, tm->tm_mon+1, 
tm->tm_mday,
                                                tm->tm_hour, tm->tm_min);
+               if(prefix && *prefix) {
+                       fprintf(handle->logstream, "[%s] ", prefix);
+               };
                ret = vfprintf(handle->logstream, fmt, args);
                fflush(handle->logstream);
        }
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 5043476..2726443 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -119,7 +119,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char 
*archive, const char *prefix,
                alpm_list_t *list, int breakfirst);
 
 ssize_t _alpm_files_in_directory(alpm_handle_t *handle, const char *path, int 
full_count);
-int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args);
+int _alpm_logaction(alpm_handle_t *handle, const char *prefix, const char 
*fmt, va_list args);
 int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const 
argv[]);
 int _alpm_ldconfig(alpm_handle_t *handle);
 int _alpm_str_cmp(const void *s1, const void *s2);
-- 
1.8.0.2


Reply via email to