Browse Source

Log to syslog as well

Andrea Luzzardi 18 years ago
parent
commit
e99495ea5c
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      src/log.c

+ 14
- 1
src/log.c View File

@ -16,14 +16,21 @@
*/
#include <stdio.h>
#include <syslog.h>
#include <stdarg.h>
#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);
}

Loading…
Cancel
Save