summaryrefslogtreecommitdiff
path: root/lib/libalpm/log.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-07 20:55:13 -0400
committerDan McGee <dan@archlinux.org>2007-06-09 12:57:50 -0400
commita32ca90192ea2b2df2fadb820c9e47bbaec93151 (patch)
tree7f105ea98d8fbc52ed978c7efe4a4204e33a22f2 /lib/libalpm/log.c
parentfc93601b9887ec42cd71339099eadc6fb7b775e5 (diff)
downloadpacman-a32ca90192ea2b2df2fadb820c9e47bbaec93151.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/log.c')
-rw-r--r--lib/libalpm/log.c21
1 files changed, 8 insertions, 13 deletions
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: */