From 41d42babe6c29739cf2dfdab2c8251b7d42081f3 Mon Sep 17 00:00:00 2001 From: Benjamin Runnels Date: Tue, 12 Apr 2016 16:08:02 -0500 Subject: [PATCH] Restored ability to remove syslog from CFLAGS in Makefile --- esp-link.vcxproj | 7 +++++++ esp-link/cgiservices.c | 4 ++++ esp-link/main.c | 10 ++++++++++ serial/serbridge.c | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/esp-link.vcxproj b/esp-link.vcxproj index 9b50cfc..88d7277 100644 --- a/esp-link.vcxproj +++ b/esp-link.vcxproj @@ -111,8 +111,14 @@ + + + + + + @@ -122,6 +128,7 @@ + {A92F0CAA-F89B-4F78-AD2A-A042429BD87F} diff --git a/esp-link/cgiservices.c b/esp-link/cgiservices.c index 6b3f553..8718c28 100644 --- a/esp-link/cgiservices.c +++ b/esp-link/cgiservices.c @@ -2,7 +2,9 @@ #include "cgiwifi.h" #include "cgi.h" #include "config.h" +#ifdef SYSLOG #include "syslog.h" +#endif #include "sntp.h" #include "cgimqtt.h" @@ -152,7 +154,9 @@ int ICACHE_FLASH_ATTR cgiServicesSet(HttpdConnData *connData) { if (syslog < 0) return HTTPD_CGI_DONE; if (syslog > 0) { +#ifdef SYSLOG syslog_init(flashConfig.syslog_host); +#endif } int8_t sntp = 0; diff --git a/esp-link/main.c b/esp-link/main.c index bf8c6ef..1094628 100644 --- a/esp-link/main.c +++ b/esp-link/main.c @@ -29,13 +29,23 @@ #include "config.h" #include "log.h" #include "gpio.h" +#ifdef SYSLOG #include "syslog.h" +#endif #include "cgiservices.h" + +#ifdef SYSLOG #define NOTICE(format, ...) do { \ LOG_NOTICE(format, ## __VA_ARGS__ ); \ os_printf(format "\n", ## __VA_ARGS__); \ } while ( 0 ) +#else +#define NOTICE(format, ...) do { \ + os_printf(format "\n", ## __VA_ARGS__); \ +} while ( 0 ) +#endif + /* This is the main url->function dispatching data struct. diff --git a/serial/serbridge.c b/serial/serbridge.c index 1e82e3d..93d3328 100644 --- a/serial/serbridge.c +++ b/serial/serbridge.c @@ -10,7 +10,9 @@ #include "console.h" #include "slip.h" #include "cmd.h" +#ifdef SYSLOG #include "syslog.h" +#endif #define SKIP_AT_RESET @@ -405,12 +407,16 @@ serbridgeConnectCb(void *arg) #ifdef SERBR_DBG os_printf("Accept port %d, conn=%p, pool slot %d\n", conn->proto.tcp->local_port, conn, i); #endif +#ifdef SYSLOG syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_NOTICE, "esp-link", "Accept port %d, conn=%p, pool slot %d\n", conn->proto.tcp->local_port, conn, i); +#endif if (i==MAX_CONN) { #ifdef SERBR_DBG os_printf("Aiee, conn pool overflow!\n"); #endif +#ifdef SYSLOG syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_WARNING, "esp-link", "Aiee, conn pool overflow!\n"); +#endif espconn_disconnect(conn); return; }