mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Simplified the logging interface.
This commit is contained in:
parent
38f815d439
commit
45b3166729
4
config.c
4
config.c
@ -14,9 +14,9 @@ cSatipConfig SatipConfig;
|
|||||||
cSatipConfig::cSatipConfig(void)
|
cSatipConfig::cSatipConfig(void)
|
||||||
: operatingModeM(eOperatingModeLow),
|
: operatingModeM(eOperatingModeLow),
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
loggingM(eLoggingDebug1 & eLoggingDebug2),
|
loggingModeM(eLoggingModeDebug1 & eLoggingModeDebug2),
|
||||||
#else
|
#else
|
||||||
loggingM(eLoggingNormal),
|
loggingModeM(eLoggingModeNormal),
|
||||||
#endif
|
#endif
|
||||||
eitScanM(1),
|
eitScanM(1),
|
||||||
useBytesM(1)
|
useBytesM(1)
|
||||||
|
39
config.h
39
config.h
@ -15,7 +15,7 @@ class cSatipConfig
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
unsigned int operatingModeM;
|
unsigned int operatingModeM;
|
||||||
unsigned int loggingM;
|
unsigned int loggingModeM;
|
||||||
unsigned int eitScanM;
|
unsigned int eitScanM;
|
||||||
unsigned int useBytesM;
|
unsigned int useBytesM;
|
||||||
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
|
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
|
||||||
@ -23,24 +23,24 @@ private:
|
|||||||
char configDirectoryM[PATH_MAX];
|
char configDirectoryM[PATH_MAX];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum eOperatingMode {
|
||||||
eOperatingModeOff = 0,
|
eOperatingModeOff = 0,
|
||||||
eOperatingModeLow,
|
eOperatingModeLow,
|
||||||
eOperatingModeNormal,
|
eOperatingModeNormal,
|
||||||
eOperatingModeHigh,
|
eOperatingModeHigh,
|
||||||
eOperatingModeCount
|
eOperatingModeCount
|
||||||
};
|
};
|
||||||
enum {
|
enum eLoggingMode {
|
||||||
eLoggingNormal = 0x00,
|
eLoggingModeNormal = 0x00,
|
||||||
eLoggingDebug1 = 0x01,
|
eLoggingModeDebug1 = 0x01,
|
||||||
eLoggingDebug2 = 0x02,
|
eLoggingModeDebug2 = 0x02,
|
||||||
eLoggingDebug3 = 0x04,
|
eLoggingModeDebug3 = 0x04,
|
||||||
eLoggingDebug4 = 0x08,
|
eLoggingModeDebug4 = 0x08,
|
||||||
eLoggingDebug5 = 0x10,
|
eLoggingModeDebug5 = 0x10,
|
||||||
eLoggingDebug6 = 0x20,
|
eLoggingModeDebug6 = 0x20,
|
||||||
eLoggingDebug7 = 0x40,
|
eLoggingModeDebug7 = 0x40,
|
||||||
eLoggingDebug8 = 0x80,
|
eLoggingModeDebug8 = 0x80,
|
||||||
eLoggingMask = 0xFF
|
eLoggingModeMask = 0xFF
|
||||||
};
|
};
|
||||||
cSatipConfig();
|
cSatipConfig();
|
||||||
unsigned int GetOperatingMode(void) const { return operatingModeM; }
|
unsigned int GetOperatingMode(void) const { return operatingModeM; }
|
||||||
@ -49,15 +49,8 @@ public:
|
|||||||
bool IsOperatingModeNormal(void) const { return (operatingModeM == eOperatingModeNormal); }
|
bool IsOperatingModeNormal(void) const { return (operatingModeM == eOperatingModeNormal); }
|
||||||
bool IsOperatingModeHigh(void) const { return (operatingModeM == eOperatingModeHigh); }
|
bool IsOperatingModeHigh(void) const { return (operatingModeM == eOperatingModeHigh); }
|
||||||
void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; }
|
void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; }
|
||||||
unsigned int GetLogging(void) const { return loggingM; }
|
unsigned int GetLoggingMode(void) const { return loggingModeM; }
|
||||||
bool IsLoggingDebug1(void) const { return (loggingM & eLoggingDebug1); }
|
bool IsLoggingMode(eLoggingMode modeP) const { return (loggingModeM & modeP); }
|
||||||
bool IsLoggingDebug2(void) const { return (loggingM & eLoggingDebug2); }
|
|
||||||
bool IsLoggingDebug3(void) const { return (loggingM & eLoggingDebug3); }
|
|
||||||
bool IsLoggingDebug4(void) const { return (loggingM & eLoggingDebug4); }
|
|
||||||
bool IsLoggingDebug5(void) const { return (loggingM & eLoggingDebug5); }
|
|
||||||
bool IsLoggingDebug6(void) const { return (loggingM & eLoggingDebug6); }
|
|
||||||
bool IsLoggingDebug7(void) const { return (loggingM & eLoggingDebug7); }
|
|
||||||
bool IsLoggingDebug8(void) const { return (loggingM & eLoggingDebug8); }
|
|
||||||
unsigned int GetEITScan(void) const { return eitScanM; }
|
unsigned int GetEITScan(void) const { return eitScanM; }
|
||||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||||
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
||||||
@ -67,7 +60,7 @@ public:
|
|||||||
int GetDisabledFilters(unsigned int indexP) const;
|
int GetDisabledFilters(unsigned int indexP) const;
|
||||||
|
|
||||||
void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; }
|
void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; }
|
||||||
void SetLogging(unsigned int logLevelP) { loggingM = (logLevelP & eLoggingMask); }
|
void SetLoggingMode(unsigned int modeP) { loggingModeM = (modeP & eLoggingModeMask); }
|
||||||
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
|
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
|
||||||
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
||||||
void SetConfigDirectory(const char *directoryP);
|
void SetConfigDirectory(const char *directoryP);
|
||||||
|
@ -199,7 +199,7 @@ void cSatipDiscover::Fetch(const char *urlP)
|
|||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
|
|
||||||
// Verbose output
|
// Verbose output
|
||||||
if (SatipConfig.IsLoggingDebug2()) {
|
if (SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug2)) {
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback);
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
||||||
|
16
log.h
16
log.h
@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
#define error(x...) esyslog("SATIP-ERROR: " x)
|
#define error(x...) esyslog("SATIP-ERROR: " x)
|
||||||
#define info(x...) isyslog("SATIP: " x)
|
#define info(x...) isyslog("SATIP: " x)
|
||||||
#define debug1(x...) void( SatipConfig.IsLoggingDebug1() ? dsyslog("SATIP: " x) : void() )
|
#define debug1(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug1) ? dsyslog("SATIP1: " x) : void() )
|
||||||
#define debug2(x...) void( SatipConfig.IsLoggingDebug2() ? dsyslog("SATIP: " x) : void() )
|
#define debug2(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug2) ? dsyslog("SATIP2: " x) : void() )
|
||||||
#define debug3(x...) void( SatipConfig.IsLoggingDebug3() ? dsyslog("SATIP: " x) : void() )
|
#define debug3(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug3) ? dsyslog("SATIP3: " x) : void() )
|
||||||
#define debug4(x...) void( SatipConfig.IsLoggingDebug4() ? dsyslog("SATIP: " x) : void() )
|
#define debug4(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug4) ? dsyslog("SATIP4: " x) : void() )
|
||||||
#define debug5(x...) void( SatipConfig.IsLoggingDebug5() ? dsyslog("SATIP: " x) : void() )
|
#define debug5(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug5) ? dsyslog("SATIP5: " x) : void() )
|
||||||
#define debug6(x...) void( SatipConfig.IsLoggingDebug6() ? dsyslog("SATIP: " x) : void() )
|
#define debug6(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug6) ? dsyslog("SATIP6: " x) : void() )
|
||||||
#define debug7(x...) void( SatipConfig.IsLoggingDebug7() ? dsyslog("SATIP: " x) : void() )
|
#define debug7(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug7) ? dsyslog("SATIP7: " x) : void() )
|
||||||
#define debug8(x...) void( SatipConfig.IsLoggingDebug8() ? dsyslog("SATIP: " x) : void() )
|
#define debug8(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug8) ? dsyslog("SATIP8: " x) : void() )
|
||||||
|
|
||||||
#endif // __SATIP_LOG_H
|
#endif // __SATIP_LOG_H
|
||||||
|
|
||||||
|
2
rtsp.c
2
rtsp.c
@ -21,7 +21,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
|
|||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
|
|
||||||
// Verbose output
|
// Verbose output
|
||||||
if (SatipConfig.IsLoggingDebug2()) {
|
if (SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug2)) {
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipRtsp::DebugCallback);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipRtsp::DebugCallback);
|
||||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
||||||
|
6
satip.c
6
satip.c
@ -103,7 +103,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
|||||||
deviceCountM = strtol(optarg, NULL, 0);
|
deviceCountM = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
SatipConfig.SetLogging(strtol(optarg, NULL, 0));
|
SatipConfig.SetLoggingMode(strtol(optarg, NULL, 0));
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
ParseServer(optarg);
|
ParseServer(optarg);
|
||||||
@ -405,8 +405,8 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in
|
|||||||
}
|
}
|
||||||
else if (strcasecmp(commandP, "LOGG") == 0) {
|
else if (strcasecmp(commandP, "LOGG") == 0) {
|
||||||
if (optionP && *optionP)
|
if (optionP && *optionP)
|
||||||
SatipConfig.SetLogging(strtol(optionP, NULL, 0));
|
SatipConfig.SetLoggingMode(strtol(optionP, NULL, 0));
|
||||||
return cString::sprintf("SAT>IP logging: 0x%02X\n", SatipConfig.GetLogging());
|
return cString::sprintf("SAT>IP logging: 0x%02X\n", SatipConfig.GetLoggingMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user