index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-01-18 20:42:21 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-01-28 23:38:46 +1000 |
commit | 66a9b5314123b3632cb90a4d37fd422a0f898568 (patch) | |
tree | 689776d6536072ed623813fae6e088969d01498f /lib/libalpm/util.c | |
parent | 8308c7b320ae230252ff0e79ea18cbfed0d13e81 (diff) |
-rw-r--r-- | lib/libalpm/util.c | 13 |
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); |