diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2015-04-12 06:01:20 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-05-12 06:00:54 +0200 |
commit | ae7067440c20c49b3d11c63844d583381282c6b2 (patch) | |
tree | a8649744ff7c3d6cc2e408d2745c787b82e6b563 /lib/libalpm/util.c | |
parent | f9423cfa5d5b9f2041b70676438082faad1cd1ee (diff) | |
download | pacman-ae7067440c20c49b3d11c63844d583381282c6b2.tar.gz pacman-ae7067440c20c49b3d11c63844d583381282c6b2.tar.xz |
merge _alpm_logaction into alpm_logaction
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r-- | lib/libalpm/util.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 26d091b6..66a27426 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -27,7 +27,6 @@ #include <ctype.h> #include <dirent.h> #include <time.h> -#include <syslog.h> #include <errno.h> #include <limits.h> #include <sys/wait.h> @@ -446,49 +445,6 @@ ssize_t _alpm_files_in_directory(alpm_handle_t *handle, const char *path, return files; } -/** Write formatted message to log. - * @param handle the context handle - * @param format formatted string to write out - * @param args formatting arguments - * @return 0 or number of characters written on success, vfprintf return value - * on error - */ -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. */ - va_list args_syslog; - va_copy(args_syslog, args); - vsyslog(LOG_WARNING, fmt, args_syslog); - va_end(args_syslog); - } - - if(handle->logstream) { - time_t t; - struct tm *tm; - - t = time(NULL); - tm = localtime(&t); - - /* Use ISO-8601 date format */ - 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, prefix); - ret = vfprintf(handle->logstream, fmt, args); - fflush(handle->logstream); - } - - return ret; -} - /** Execute a command with arguments in a chroot. * @param handle the context handle * @param cmd command to execute |