summaryrefslogtreecommitdiffstats
path: root/src/pacman/callback.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-08 02:55:13 +0200
committerDan McGee <dan@archlinux.org>2007-06-09 18:57:50 +0200
commita32ca90192ea2b2df2fadb820c9e47bbaec93151 (patch)
tree7f105ea98d8fbc52ed978c7efe4a4204e33a22f2 /src/pacman/callback.c
parentfc93601b9887ec42cd71339099eadc6fb7b775e5 (diff)
downloadpacman-a32ca90192ea2b2df2fadb820c9e47bbaec93151.tar.gz
pacman-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 'src/pacman/callback.c')
-rw-r--r--src/pacman/callback.c47
1 files changed, 3 insertions, 44 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index baefacc0..607d6329 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -593,54 +593,13 @@ void cb_dl_progress(const char *filename, int xfered, int total)
}
/* Callback to handle notifications from the library */
-void cb_log(pmloglevel_t level, char *msg)
+void cb_log(pmloglevel_t level, char *fmt, va_list args)
{
- char str[LOG_STR_LEN] = "";
-
- if(!strlen(msg)) {
+ if(!strlen(fmt)) {
return;
}
- switch(level) {
- case PM_LOG_DEBUG:
- sprintf(str, _("debug"));
- break;
- case PM_LOG_ERROR:
- sprintf(str, _("error"));
- break;
- case PM_LOG_WARNING:
- sprintf(str, _("warning"));
- break;
- case PM_LOG_FUNCTION:
- /* TODO we should increase the indent level when this occurs so we can see
- * program flow easier. It'll be fun
- */
- sprintf(str, _("function"));
- break;
- default:
- sprintf(str, "???");
- break;
- }
-
-#ifdef PACMAN_DEBUG
- /* If debug is on, we'll timestamp the output */
- if(alpm_option_get_logmask() & PM_LOG_DEBUG) {
- time_t t;
- struct tm *tmp;
- char timestr[10] = {0};
-
- t = time(NULL);
- tmp = localtime(&t);
- strftime(timestr, 9, "%H:%M:%S", tmp);
- timestr[8] = '\0';
-
- printf("[%s] %s: %s\n", timestr, str, msg);
- } else {
- printf("%s: %s\n", str, msg);
- }
-#else
- printf("%s: %s\n", str, msg);
-#endif
+ pm_vfprintf(stdout, level, fmt, args);
}
/* vim: set ts=2 sw=2 noet: */