From e99495ea5c996ef065e4cf2eb864ff4bb7ac9e91 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 10 Oct 2006 22:08:04 +0000 Subject: [PATCH] Log to syslog as well --- src/log.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index 561045b..9999b8b 100644 --- a/src/log.c +++ b/src/log.c @@ -16,14 +16,21 @@ */ #include +#include #include #include "log.h" +static void pusb_log_syslog(int level, const char *format, va_list ap) +{ + openlog("pam_usb", LOG_PID, LOG_AUTH); + vsyslog(level, format, ap); + closelog(); +} + void __log_debug(const char *file, int line, const char *fmt, ...) { va_list ap; - return ; fprintf(stderr, "\033[01;34m*\033[00m [%s:%03d] ", file, line); va_start(ap, fmt); vfprintf(stderr, fmt, ap); @@ -38,6 +45,9 @@ void log_error(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + va_start(ap, fmt); + pusb_log_syslog(LOG_ERR, fmt, ap); + va_end(ap); } void log_info(const char *fmt, ...) @@ -48,4 +58,7 @@ void log_info(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + va_start(ap, fmt); + pusb_log_syslog(LOG_NOTICE, fmt, ap); + va_end(ap); }