changeset 349:2466a765e4d5

the start of that syslog patch
author Louis Opter <kalessin@kalessin.fr>
date Mon, 12 Oct 2015 22:36:52 -0700
parents 74a868ff0bfa
children fe80b07a322a
files add_syslog_support.patch series
diffstat 2 files changed, 70 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/add_syslog_support.patch	Mon Oct 12 22:36:52 2015 -0700
@@ -0,0 +1,69 @@
+# HG changeset patch
+# Parent  1f3893f2eaddaae9e545a65594b37973f9a981de
+Add the --syslog (-S) and --syslog-facility (-F) logging options
+
+Closes GH-1.
+
+diff --git a/core/lightsd.h b/core/lightsd.h
+--- a/core/lightsd.h
++++ b/core/lightsd.h
+@@ -126,14 +126,12 @@
+ #define LGTD_PRINT_DURATION(secs, arr) \
+     lgtd_print_duration((secs), (arr), sizeof((arr)))
+ 
+-void _lgtd_err(void (*)(int, const char *, ...), int, const char *, ...)
+-    __attribute__((format(printf, 3, 4)));
+-#define lgtd_err(eval, fmt, ...) _lgtd_err(err, (eval), (fmt), ##__VA_ARGS__);
+-#define lgtd_errx(eval, fmt, ...) _lgtd_err(errx, (eval), (fmt), ##__VA_ARGS__);
+-void _lgtd_warn(void (*)(const char *, va_list), const char *, ...)
+-    __attribute__((format(printf, 2, 3)));
+-#define lgtd_warn(fmt, ...) _lgtd_warn(vwarn, (fmt), ##__VA_ARGS__);
+-#define lgtd_warnx(fmt, ...) _lgtd_warn(vwarnx, (fmt), ##__VA_ARGS__);
++void lgtd_log_open(const char *);
++void lgtd_log_close(void);
++void lgtd_err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
++void lgtd_errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
++void lgtd_warn(const char *, ...) __attribute__((format(printf, 1, 2)));
++void lgtd_warnx(const char *, ...) __attribute__((format(printf, 1, 2)));
+ void lgtd_info(const char *, ...) __attribute__((format(printf, 1, 2)));
+ void lgtd_debug(const char *, ...) __attribute__((format(printf, 1, 2)));
+ void lgtd_libevent_log(int, const char *);
+diff --git a/core/log.c b/core/log.c
+--- a/core/log.c
++++ b/core/log.c
+@@ -165,9 +165,9 @@
+ 
+ void
+ _lgtd_err(void (*errfn)(int, const char *, ...),
+-           int eval,
+-           const char *fmt,
+-           ...)
++          int eval,
++          const char *fmt,
++          va_list ap)
+ {
+     int errsave = errno;
+     va_list ap;
+@@ -183,8 +183,21 @@
+     errfn(eval, errmsg);
+ }
+ 
++
+ void
+-_lgtd_warn(void (*warnfn)(const char *, va_list), const char *fmt, ...)
++lgtd_err(int eval, const char *fmt, ...)
++{
++
++}
++
++void
++lgtd_errx(int eval, const char *fmt, ...)
++{
++
++}
++
++void
++_lgtd_warn(void (*warnfn)(int, const char *, ...), const char *fmt, va_list)
+ {
+     if (lgtd_opts.verbosity <= LGTD_WARN) {
+         va_list ap;
--- a/series	Sat Sep 19 06:08:14 2015 -0700
+++ b/series	Mon Oct 12 22:36:52 2015 -0700
@@ -1,4 +1,5 @@
 improve_lightsc_socket_lookup.patch
+add_syslog_support.patch
 make_gateway_write_callbacks_low_priority.patch #+future
 use_echo_request_reply_to_measure_latency.patch #+future
 add_ipv4_to_ieee8023mac.patch #+future #+linux