summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 7d9ee635..5960be6a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -453,10 +453,15 @@ 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;
+ if(!(prefix && *prefix)) {
+ prefix = "UNKNOWN";
+ }
+
if(handle->usesyslog) {
/* we can't use a va_list more than once, so we need to copy it
* so we can use the original when calling vfprintf below. */
@@ -474,9 +479,9 @@ int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args)
tm = localtime(&t);
/* Use ISO-8601 date format */
- fprintf(handle->logstream, "[%04d-%02d-%02d %02d:%02d] ",
+ fprintf(handle->logstream, "[%04d-%02d-%02d %02d:%02d] [%s] ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min);
+ tm->tm_hour, tm->tm_min, prefix);
ret = vfprintf(handle->logstream, fmt, args);
fflush(handle->logstream);
}
@@ -568,7 +573,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[])
char line[PATH_MAX];
if(fgets(line, PATH_MAX, pipe_file) == NULL)
break;
- alpm_logaction(handle, "%s", line);
+ alpm_logaction(handle, "ALPM-SCRIPTLET", "%s", line);
EVENT(handle, ALPM_EVENT_SCRIPTLET_INFO, line, NULL);
}
fclose(pipe_file);