diff --git a/common.h b/common.h index 05eb802..c57274e 100644 --- a/common.h +++ b/common.h @@ -13,11 +13,6 @@ #include #include -#define error(x...) esyslog("SATIP-ERROR: " x) -#define info(x...) isyslog("SATIP: " x) -#define debug(x...) void( SatipConfig.IsLogLevelDebug() ? dsyslog("SATIP: " x) : void() ) -#define extra(x...) void( SatipConfig.IsLogLevelExtra() ? dsyslog("SATIP: " x) : void() ) - #define ELEMENTS(x) (sizeof(x) / sizeof(x[0])) #define SATIP_MAX_DEVICES MAXDEVICES @@ -44,19 +39,19 @@ #define SATIP_CURL_EASY_SETOPT(X, Y, Z) \ if ((res = curl_easy_setopt((X), (Y), (Z))) != CURLE_OK) { \ - error("curl_easy_setopt(%s, %s) [%s,%d] failed: %s (%d)", #Y, #Z, __FILE__, __LINE__, curl_easy_strerror(res), res); \ + esyslog("curl_easy_setopt(%s, %s) [%s,%d] failed: %s (%d)", #Y, #Z, __FILE__, __LINE__, curl_easy_strerror(res), res); \ } #define SATIP_CURL_EASY_PERFORM(X) \ if ((res = curl_easy_perform((X))) != CURLE_OK) { \ - error("curl_easy_perform() [%s,%d] failed: %s (%d)", __FILE__, __LINE__, curl_easy_strerror(res), res); \ + esyslog("curl_easy_perform() [%s,%d] failed: %s (%d)", __FILE__, __LINE__, curl_easy_strerror(res), res); \ } #define ERROR_IF_FUNC(exp, errstr, func, ret) \ do { \ if (exp) { \ char tmp[64]; \ - error("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \ + esyslog("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \ strerror_r(errno, tmp, sizeof(tmp))); \ func; \ ret; \ diff --git a/config.c b/config.c index ce3ae6b..96f8987 100644 --- a/config.c +++ b/config.c @@ -6,6 +6,7 @@ */ #include "discover.h" +#include "log.h" #include "config.h" cSatipConfig SatipConfig; diff --git a/device.c b/device.c index da3bbdb..4282c72 100644 --- a/device.c +++ b/device.c @@ -9,6 +9,7 @@ #include "config.h" #include "discover.h" +#include "log.h" #include "param.h" #include "device.h" diff --git a/discover.c b/discover.c index b3ac667..2628964 100644 --- a/discover.c +++ b/discover.c @@ -13,6 +13,7 @@ #endif #include "common.h" #include "config.h" +#include "log.h" #include "socket.h" #include "discover.h" diff --git a/log.h b/log.h new file mode 100644 index 0000000..0830f71 --- /dev/null +++ b/log.h @@ -0,0 +1,19 @@ +/* + * log.h: SAT>IP plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + */ + +#ifndef __SATIP_LOG_H +#define __SATIP_LOG_H + +#include "config.h" + +#define error(x...) esyslog("SATIP-ERROR: " x) +#define info(x...) isyslog("SATIP: " x) +#define debug(x...) void( SatipConfig.IsLogLevelDebug() ? dsyslog("SATIP: " x) : void() ) +#define extra(x...) void( SatipConfig.IsLogLevelExtra() ? dsyslog("SATIP: " x) : void() ) + +#endif // __SATIP_LOG_H + diff --git a/msearch.c b/msearch.c index d4d8461..1425a57 100644 --- a/msearch.c +++ b/msearch.c @@ -8,6 +8,7 @@ #include "config.h" #include "common.h" #include "discover.h" +#include "log.h" #include "poller.h" #include "msearch.h" diff --git a/poller.c b/poller.c index 1b92409..fb79af9 100644 --- a/poller.c +++ b/poller.c @@ -11,6 +11,7 @@ #include "config.h" #include "common.h" +#include "log.h" #include "poller.h" cSatipPoller *cSatipPoller::instanceS = NULL; diff --git a/rtcp.c b/rtcp.c index fb58212..4d6065f 100644 --- a/rtcp.c +++ b/rtcp.c @@ -7,6 +7,7 @@ #include "config.h" #include "common.h" +#include "log.h" #include "rtcp.h" cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) diff --git a/rtp.c b/rtp.c index 85437de..2da23e6 100644 --- a/rtp.c +++ b/rtp.c @@ -7,6 +7,7 @@ #include "config.h" #include "common.h" +#include "log.h" #include "rtp.h" cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) diff --git a/rtsp.c b/rtsp.c index a1ead50..b94427f 100644 --- a/rtsp.c +++ b/rtsp.c @@ -7,6 +7,7 @@ #include "config.h" #include "common.h" +#include "log.h" #include "rtsp.h" cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) diff --git a/satip.c b/satip.c index 3e82cf6..b9c54ca 100644 --- a/satip.c +++ b/satip.c @@ -11,6 +11,7 @@ #include "config.h" #include "device.h" #include "discover.h" +#include "log.h" #include "poller.h" #include "setup.h" diff --git a/sectionfilter.c b/sectionfilter.c index 99f682c..88c8d4c 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -6,6 +6,7 @@ */ #include "config.h" +#include "log.h" #include "sectionfilter.h" cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t tidP, uint8_t maskP) diff --git a/server.c b/server.c index 8f60213..5ff5bd0 100644 --- a/server.c +++ b/server.c @@ -9,6 +9,7 @@ #include "config.h" #include "common.h" +#include "log.h" #include "server.h" // --- cSatipServer ----------------------------------------------------------- diff --git a/setup.c b/setup.c index 8e389c5..eca22a4 100644 --- a/setup.c +++ b/setup.c @@ -12,6 +12,7 @@ #include "config.h" #include "device.h" #include "discover.h" +#include "log.h" #include "setup.h" // --- cSatipEditSrcItem ------------------------------------------------------ diff --git a/socket.c b/socket.c index d7b9ce4..fabb968 100644 --- a/socket.c +++ b/socket.c @@ -16,6 +16,7 @@ #include "common.h" #include "config.h" +#include "log.h" #include "socket.h" cSatipSocket::cSatipSocket() diff --git a/statistics.c b/statistics.c index cb8b51e..d925812 100644 --- a/statistics.c +++ b/statistics.c @@ -9,6 +9,7 @@ #include "common.h" #include "statistics.h" +#include "log.h" #include "config.h" // Section statistics class diff --git a/tuner.c b/tuner.c index bdf8b34..16749fa 100644 --- a/tuner.c +++ b/tuner.c @@ -8,6 +8,7 @@ #include "common.h" #include "config.h" #include "discover.h" +#include "log.h" #include "poller.h" #include "tuner.h"