Allow syslog to be disabled, as in #128

pull/163/head
Thorsten von Eicken 9 years ago
parent 38f5376196
commit f84ffdc989
  1. 2
      Makefile
  2. 10
      esp-link/cgiservices.c
  3. 8
      esp-link/main.c
  4. 1
      html/services.js
  5. 4
      serial/serbridge.c

@ -101,7 +101,7 @@ LED_SERIAL_PIN ?= 14
# --------------- esp-link modules config options ---------------
# Optional Modules mqtt
MODULES ?= mqtt rest syslog
MODULES ?= mqtt rest #syslog
# --------------- esphttpd config options ---------------

@ -2,9 +2,11 @@
#include "cgiwifi.h"
#include "cgi.h"
#include "config.h"
#include "syslog.h"
#include "sntp.h"
#include "cgimqtt.h"
#ifdef SYSLOG
#include "syslog.h"
#endif
#ifdef CGISERVICES_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
@ -109,21 +111,25 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
os_sprintf(buff,
"{ "
#ifdef SYSLOG
"\"syslog_host\": \"%s\", "
"\"syslog_minheap\": %d, "
"\"syslog_filter\": %d, "
"\"syslog_showtick\": \"%s\", "
"\"syslog_showdate\": \"%s\", "
#endif
"\"timezone_offset\": %d, "
"\"sntp_server\": \"%s\", "
"\"mdns_enable\": \"%s\", "
"\"mdns_servername\": \"%s\""
" }",
#ifdef SYSLOG
flashConfig.syslog_host,
flashConfig.syslog_minheap,
flashConfig.syslog_filter,
flashConfig.syslog_showtick ? "enabled" : "disabled",
flashConfig.syslog_showdate ? "enabled" : "disabled",
#endif
flashConfig.timezone_offset,
flashConfig.sntp_server,
flashConfig.mdns_enable ? "enabled" : "disabled",
@ -151,9 +157,11 @@ int ICACHE_FLASH_ATTR cgiServicesSet(HttpdConnData *connData) {
syslog |= getBoolArg(connData, "syslog_showdate", &flashConfig.syslog_showdate);
if (syslog < 0) return HTTPD_CGI_DONE;
#ifdef SYSLOG
if (syslog > 0) {
syslog_init(flashConfig.syslog_host);
}
#endif
int8_t sntp = 0;
sntp |= getInt8Arg(connData, "timezone_offset", &flashConfig.timezone_offset);

@ -29,13 +29,19 @@
#include "config.h"
#include "log.h"
#include "gpio.h"
#include "syslog.h"
#include "cgiservices.h"
#ifdef SYSLOG
#include "syslog.h"
#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.

@ -51,6 +51,7 @@ function displayServices(data) {
$("#sntp-spinner").setAttribute("hidden", "");
$("#mdns-spinner").setAttribute("hidden", "");
if (data.syslog_host !== undefined)
$("#Syslog-form").removeAttribute("hidden");
$("#SNTP-form").removeAttribute("hidden");
$("#mDNS-form").removeAttribute("hidden");

@ -10,7 +10,11 @@
#include "console.h"
#include "slip.h"
#include "cmd.h"
#ifdef SYSLOG
#include "syslog.h"
#else
#define syslog(X1...)
#endif
#define SKIP_AT_RESET

Loading…
Cancel
Save