From a32ca90192ea2b2df2fadb820c9e47bbaec93151 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 7 Jun 2007 20:55:13 -0400 Subject: Remove logmask stuff from backend; switch logging callback to new pm_printf Remove the logmask functionality from the backend as it has been moved to the frontend, and change the logging callback function to use pm_printf. In addition, make much better use of va_list- use the args list instead of a arbitrarily chosen string to print to in the logging functions. Signed-off-by: Dan McGee --- lib/libalpm/log.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'lib/libalpm/log.c') diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index 1be7f0db..19f41283 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -43,7 +43,7 @@ */ int SYMEXPORT alpm_logaction(char *fmt, ...) { - char str[LOG_STR_LEN]; + int ret; va_list args; ALPM_LOG_FUNC; @@ -52,7 +52,7 @@ int SYMEXPORT alpm_logaction(char *fmt, ...) ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); va_start(args, fmt); - vsnprintf(str, LOG_STR_LEN, fmt, args); + ret = _alpm_logaction(handle->usesyslog, handle->logfd, fmt, args); va_end(args); /* TODO We should add a prefix to log strings depending on who called us. @@ -66,28 +66,23 @@ int SYMEXPORT alpm_logaction(char *fmt, ...) * kpacman: "KPACMAN" * This would allow us to share the log file between several frontends * and know who does what */ - return(_alpm_logaction(handle->usesyslog, handle->logfd, str)); + return(ret); } /** @} */ void _alpm_log(pmloglevel_t flag, char *fmt, ...) { + va_list args; alpm_cb_log logcb = alpm_option_get_logcb(); + if(logcb == NULL) { return; } - if(flag & alpm_option_get_logmask()) { - char str[LOG_STR_LEN]; - va_list args; - - va_start(args, fmt); - vsnprintf(str, LOG_STR_LEN, fmt, args); - va_end(args); - - logcb(flag, str); - } + va_start(args, fmt); + logcb(flag, fmt, args); + va_end(args); } /* vim: set ts=2 sw=2 noet: */ -- cgit v1.2.3-24-g4f1b