From f3dd7368d0eb270578996d78b2fc6fbc856f4bdc Mon Sep 17 00:00:00 2001 From: susisstrolch Date: Mon, 23 Nov 2015 23:45:59 +0100 Subject: [PATCH] fix rebase / merge errors - missing LOG_xxx macros in syslog.h - fixed tag (esp-link) in LOG_xxx macro --- syslog/syslog.c | 6 ++++++ syslog/syslog.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/syslog/syslog.c b/syslog/syslog.c index 0a84b67..6d421f7 100644 --- a/syslog/syslog.c +++ b/syslog/syslog.c @@ -226,9 +226,15 @@ syslog_init(char *syslog_server) espconn_gethostbyname(&espconn_ghbn, host, &syslogHost.addr, syslog_gethostbyname_cb); // syslog_send_udp is called by syslog_gethostbyname_cb() } +#ifdef SYSLOG_UDP_RECV DBG_SYSLOG("syslog_init: host: %s, port: %d, lport: %d, recvcb: %p, sentcb: %p, state: %d\n", host, syslogHost.port, syslog_espconn.proto.udp->local_port, syslog_udp_recv_cb, syslog_udp_sent_cb, syslogState ); +#else + DBG_SYSLOG("syslog_init: host: %s, port: %d, lport: %d, rsentcb: %p, state: %d\n", + host, syslogHost.port, syslog_espconn.proto.udp->local_port, + syslog_udp_sent_cb, syslogState ); +#endif } /****************************************************************************** diff --git a/syslog/syslog.h b/syslog/syslog.h index d2853b9..c39eb08 100644 --- a/syslog/syslog.h +++ b/syslog/syslog.h @@ -86,6 +86,22 @@ syslog_host_t syslogserver; void ICACHE_FLASH_ATTR syslog_init(char *syslog_server); void ICACHE_FLASH_ATTR syslog(uint8_t facility, uint8_t severity, const char tag[], const char message[], ...); +// some convenience macros +#ifdef SYSLOG +// extern char *esp_link_version; // in user_main.c +#define LOG_DEBUG(format, ...) syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_DEBUG, "esp_link", format, ## __VA_ARGS__ ) +#define LOG_NOTICE(format, ...) syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_NOTICE, "esp_link", format, ## __VA_ARGS__ ) +#define LOG_INFO(format, ...) syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_INFO, "esp_link", format, ## __VA_ARGS__ ) +#define LOG_WARN(format, ...) syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_WARNING, "esp_link", format, ## __VA_ARGS__ ) +#define LOG_ERR(format, ...) syslog(SYSLOG_FAC_USER, SYSLOG_PRIO_ERR, "esp_link", format, ## __VA_ARGS__ ) +#else +#define LOG_DEBUG(format, ...) do { } while(0) +#define LOG_NOTICE(format, ...) do { } while(0) +#define LOG_WARN(format, ...) do { } while(0) +#define LOG_INFO(format, ...) do { } while(0) +#define LOG_ERR(format, ...) do { } while(0) +#endif + #ifdef __cplusplus } #endif