#############################################################################*/
#include <stdarg.h>
+#include <stdio.h>
#include <syslog.h>
#include "logging.h"
return conf->loglevel;
}
-static void fireperf_log_syslog(struct fireperf_config* conf, int priority,
+static void fireperf_log_console(struct fireperf_config* conf, int priority,
const char* file, int line, const char* fn, const char* format, va_list args) {
- openlog(PACKAGE_NAME, LOG_PID, LOG_DAEMON);
- vsyslog(priority | LOG_DAEMON, format, args);
+ switch (priority) {
+ // Print error messages to stderr
+ case LOG_ERR:
+ vfprintf(stderr, format, args);
+ break;
+
+ // Otherwise print to stdout
+ default:
+ vprintf(format, args);
+ break;
+ }
}
void fireperf_log(struct fireperf_config* conf, int priority,
va_list args;
va_start(args, format);
- fireperf_log_syslog(conf, priority, file, line, fn, format, args);
+ fireperf_log_console(conf, priority, file, line, fn, format, args);
va_end(args);
}