diff --git a/config.c b/config.c index 96f8987..cb6f67c 100644 --- a/config.c +++ b/config.c @@ -14,9 +14,9 @@ cSatipConfig SatipConfig; cSatipConfig::cSatipConfig(void) : operatingModeM(eOperatingModeLow), #ifdef DEBUG - logLevelM(eLogLevelMask), + loggingM(eLoggingMask), #else - logLevelM(eLogLevelNormal), + loggingM(eLoggingNormal), #endif eitScanM(1), useBytesM(1) diff --git a/config.h b/config.h index 3484a99..d1c32e8 100644 --- a/config.h +++ b/config.h @@ -15,7 +15,7 @@ class cSatipConfig { private: unsigned int operatingModeM; - unsigned int logLevelM; + unsigned int loggingM; unsigned int eitScanM; unsigned int useBytesM; int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT]; @@ -31,10 +31,10 @@ public: eOperatingModeCount }; enum { - eLogLevelNormal = 0x00, - eLogLevelDebug = 0x01, - eLogLevelExtra = 0x02, - eLogLevelMask = 0x0F + eLoggingNormal = 0x00, + eLoggingDebug = 0x01, + eLoggingExtra = 0x02, + eLoggingMask = 0x0F }; cSatipConfig(); unsigned int GetOperatingMode(void) const { return operatingModeM; } @@ -43,9 +43,9 @@ public: bool IsOperatingModeNormal(void) const { return (operatingModeM == eOperatingModeNormal); } bool IsOperatingModeHigh(void) const { return (operatingModeM == eOperatingModeHigh); } void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; } - unsigned int GetLogLevel(void) const { return logLevelM; } - bool IsLogLevelDebug(void) const { return (logLevelM & eLogLevelDebug); } - bool IsLogLevelExtra(void) const { return (logLevelM & eLogLevelExtra); } + unsigned int GetLogging(void) const { return loggingM; } + bool IsLoggingDebug(void) const { return (loggingM & eLoggingDebug); } + bool IsLoggingExtra(void) const { return (loggingM & eLoggingExtra); } unsigned int GetEITScan(void) const { return eitScanM; } unsigned int GetUseBytes(void) const { return useBytesM; } const char *GetConfigDirectory(void) const { return configDirectoryM; } @@ -55,7 +55,7 @@ public: int GetDisabledFilters(unsigned int indexP) const; void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; } - void SetLogLevel(unsigned int logLevelP) { logLevelM = (logLevelP & eLogLevelMask); } + void SetLogging(unsigned int logLevelP) { loggingM = (logLevelP & eLoggingMask); } void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; } void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; } void SetConfigDirectory(const char *directoryP); diff --git a/discover.c b/discover.c index 2628964..47fe1bb 100644 --- a/discover.c +++ b/discover.c @@ -199,7 +199,7 @@ void cSatipDiscover::Fetch(const char *urlP) CURLcode res = CURLE_OK; // Verbose output - if (SatipConfig.IsLogLevelExtra()) { + if (SatipConfig.IsLoggingExtra()) { SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this); diff --git a/log.h b/log.h index 0830f71..a0f5cc8 100644 --- a/log.h +++ b/log.h @@ -12,8 +12,8 @@ #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 debug(x...) void( SatipConfig.IsLoggingDebug() ? dsyslog("SATIP: " x) : void() ) +#define extra(x...) void( SatipConfig.IsLoggingExtra() ? dsyslog("SATIP: " x) : void() ) #endif // __SATIP_LOG_H diff --git a/rtsp.c b/rtsp.c index b94427f..33ba655 100644 --- a/rtsp.c +++ b/rtsp.c @@ -21,7 +21,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) CURLcode res = CURLE_OK; // Verbose output - if (SatipConfig.IsLogLevelExtra()) { + if (SatipConfig.IsLoggingExtra()) { SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipRtsp::DebugCallback); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this); diff --git a/satip.c b/satip.c index b9c54ca..2c2ea99 100644 --- a/satip.c +++ b/satip.c @@ -90,20 +90,20 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[]) debug("%s", __PRETTY_FUNCTION__); // Implement command line argument processing here if applicable. static const struct option long_options[] = { - { "devices", required_argument, NULL, 'd' }, - { "loglevel", required_argument, NULL, 'l' }, - { "server", required_argument, NULL, 's' }, - { NULL, no_argument, NULL, 0 } + { "devices", required_argument, NULL, 'd' }, + { "logging", required_argument, NULL, 'l' }, + { "server", required_argument, NULL, 's' }, + { NULL, no_argument, NULL, 0 } }; int c; while ((c = getopt_long(argc, argv, "d:l:s:", long_options, NULL)) != -1) { switch (c) { case 'd': - deviceCountM = atoi(optarg); + deviceCountM = strtol(optarg, NULL, 0); break; case 'l': - SatipConfig.SetLogLevel(atoi(optarg)); + SatipConfig.SetLogging(strtol(optarg, NULL, 0)); break; case 's': ParseServer(optarg); @@ -321,8 +321,8 @@ const char **cPluginSatip::SVDRPHelpPages(void) " Shows SAT>IP device count.\n", "OPER\n" " Toggles operating mode of SAT>IP devices.\n", - "LOGL [ ]\n" - " Gets and sets used logging level.\n", + "LOGG [ ]\n" + " Gets and sets used logging mask.\n", NULL }; return HelpPages; @@ -403,10 +403,10 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in } return cString::sprintf("SAT>IP operating mode: %s\n", *mode); } - else if (strcasecmp(commandP, "LOGL") == 0) { + else if (strcasecmp(commandP, "LOGG") == 0) { if (optionP && *optionP) - SatipConfig.SetLogLevel(atoi(optionP)); - return cString::sprintf("SAT>IP logging level: %d\n", SatipConfig.GetLogLevel()); + SatipConfig.SetLogging(strtol(optionP, NULL, 0)); + return cString::sprintf("SAT>IP logging: 0x%02X\n", SatipConfig.GetLogging()); } return NULL;