#include <crypto/hashers/hasher.h>
#include <utils/debug.h>
+#ifdef HAVE_SYSLOG
#include <syslog.h>
+#endif
#include <getopt.h>
#include <errno.h>
/* logging */
static bool log_to_stderr = TRUE;
+#ifdef HAVE_SYSLOG
static bool log_to_syslog = TRUE;
+#endif
static level_t default_loglevel = 1;
/* global variables */
*/
static void tpm_extendpcr_dbg(debug_t group, level_t level, char *fmt, ...)
{
- char buffer[8192];
- char *current = buffer, *next;
va_list args;
if (level <= default_loglevel)
va_end(args);
fprintf(stderr, "\n");
}
+#ifdef HAVE_SYSLOG
if (log_to_syslog)
{
+ char buffer[8192];
+ char *current = buffer, *next;
+
/* write in memory buffer first */
va_start(args, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, args);
current = next;
}
}
+#endif /* HAVE_SYSLOG*/
}
}
{
setbuf(stderr, NULL);
}
+#ifdef HAVE_SYSLOG
if (log_to_syslog)
{
openlog(program, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_AUTHPRIV);
}
+#endif /* HAVE_SYSLOG */
}
/**