* Misc logging changes

Addition of a forced fflush in an attempt to diagnose mutli-logging
  Removal of varargs from the internal logaction function, they are handled in
   alpm_logaction just fine
This commit is contained in:
Aaron Griffin 2007-01-17 07:21:07 +00:00
parent aea6626fde
commit 1bea7706ae
2 changed files with 6 additions and 10 deletions

View file

@ -343,17 +343,12 @@ int _alpm_rmrf(char *path)
return(0); return(0);
} }
int _alpm_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...) int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str)
{ {
char msg[1024]; _alpm_log(PM_LOG_DEBUG, _("logaction called: %s"), str);
va_list args;
va_start(args, fmt);
vsnprintf(msg, 1024, fmt, args);
va_end(args);
if(usesyslog) { if(usesyslog) {
syslog(LOG_WARNING, "%s", msg); syslog(LOG_WARNING, "%s", str);
} }
if(f) { if(f) {
@ -366,7 +361,8 @@ int _alpm_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...)
fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n", fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
tm->tm_mon+1, tm->tm_mday, tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
tm->tm_hour, tm->tm_min, tm->tm_hour, tm->tm_min,
msg); str);
fflush(f);
} }
return(0); return(0);

View file

@ -62,7 +62,7 @@ int _alpm_lckmk(char *file);
int _alpm_lckrm(char *file); int _alpm_lckrm(char *file);
int _alpm_unpack(const char *archive, const char *prefix, const char *fn); int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
int _alpm_rmrf(char *path); int _alpm_rmrf(char *path);
int _alpm_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...); int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str);
int _alpm_ldconfig(char *root); int _alpm_ldconfig(char *root);
#ifdef _ALPM_TRANS_H #ifdef _ALPM_TRANS_H
int _alpm_runscriptlet(char *util, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans); int _alpm_runscriptlet(char *util, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans);