diff --git a/DStarGateway/DStarGatewayApp.cpp b/DStarGateway/DStarGatewayApp.cpp index 5b3301c..070421c 100644 --- a/DStarGateway/DStarGatewayApp.cpp +++ b/DStarGateway/DStarGatewayApp.cpp @@ -369,7 +369,7 @@ bool CDStarGatewayApp::createThread() m_thread->setInfoEnabled(true); m_thread->setEchoEnabled(true); m_thread->setDTMFEnabled(true); - m_thread->setLog(true); + m_thread->setLog(true, log.logIRCDDBTraffic); return true; } diff --git a/DStarGateway/DStarGatewayConfig.cpp b/DStarGateway/DStarGatewayConfig.cpp index 0833678..b30bc71 100644 --- a/DStarGateway/DStarGatewayConfig.cpp +++ b/DStarGateway/DStarGatewayConfig.cpp @@ -185,6 +185,8 @@ bool CDStarGatewayConfig::loadLog(const CConfig & cfg) else if(levelStr == "none") m_log.displayLevel = LOG_NONE; } + ret = cfg.getValue("log", "logIRCDDBTraffic", m_log.logIRCDDBTraffic, false) && ret; + std::string thresholdStr; ret = cfg.getValue("log", "repeatthreshold", thresholdStr, "2", {"disabled", "1", "2", "3", "4","5", "6", "7", "8", "9", "10"}) && ret; if(thresholdStr == "disabled") m_log.repeatThreshold = 0; diff --git a/DStarGateway/DStarGatewayConfig.h b/DStarGateway/DStarGatewayConfig.h index 2d5bf62..0ec16b4 100644 --- a/DStarGateway/DStarGatewayConfig.h +++ b/DStarGateway/DStarGatewayConfig.h @@ -95,6 +95,7 @@ typedef struct { std::string fileRoot; bool fileRotate; uint repeatThreshold; + bool logIRCDDBTraffic; } TLog; typedef struct { diff --git a/DStarGateway/DStarGatewayThread.cpp b/DStarGateway/DStarGatewayThread.cpp index a6f204d..d86922d 100644 --- a/DStarGateway/DStarGatewayThread.cpp +++ b/DStarGateway/DStarGatewayThread.cpp @@ -96,6 +96,7 @@ m_infoEnabled(true), m_echoEnabled(true), m_dtmfEnabled(true), m_logEnabled(false), +m_logIRCDDB(false), m_ddModeEnabled(false), m_lastStatus(IS_DISABLED), m_statusTimer1(1000U, 1U), // 1 second @@ -633,9 +634,10 @@ void CDStarGatewayThread::setCCS(bool enabled, const std::string& host) } #endif -void CDStarGatewayThread::setLog(bool enabled) +void CDStarGatewayThread::setLog(bool enabled, bool logIRCDDBTraffic) { m_logEnabled = enabled; + m_logIRCDDB = logIRCDDBTraffic; } void CDStarGatewayThread::setAPRSWriters(CAPRSHandler* outgoingWriter, CAPRSHandler* incomingWriter) @@ -746,11 +748,13 @@ void CDStarGatewayThread::processIrcDDB() if (!res) break; - if (!address.empty()) { - CLog::logDebug("USER: %s %s %s %s", user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str()); + if(m_logIRCDDB) { + if (!address.empty()) { + CLog::logInfo("USER: %s %s %s %s", user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str()); m_cache.updateUser(user, repeater, gateway, address, timestamp, DP_DEXTRA, false, false); - } else { - CLog::logDebug("USER: %s NOT FOUND", user.c_str()); + } else { + CLog::logInfo("USER: %s NOT FOUND", user.c_str()); + } } } break; @@ -762,11 +766,13 @@ void CDStarGatewayThread::processIrcDDB() break; CRepeaterHandler::resolveRepeater(repeater, gateway, address, DP_DEXTRA); - if (!address.empty()) { - CLog::logDebug("REPEATER: %s %s %s", repeater.c_str(), gateway.c_str(), address.c_str()); - m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false); - } else { - CLog::logDebug("REPEATER: %s NOT FOUND", repeater.c_str()); + if(m_logIRCDDB) { + if (!address.empty()) { + CLog::logInfo("REPEATER: %s %s %s", repeater.c_str(), gateway.c_str(), address.c_str()); + m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false); + } else { + CLog::logInfo("REPEATER: %s NOT FOUND", repeater.c_str()); + } } } break; @@ -779,11 +785,14 @@ void CDStarGatewayThread::processIrcDDB() CDExtraHandler::gatewayUpdate(gateway, address); CDPlusHandler::gatewayUpdate(gateway, address); - if (!address.empty()) { - CLog::logDebug("GATEWAY: %s %s", gateway.c_str(), address.c_str()); - m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false); - } else { - CLog::logDebug("GATEWAY: %s NOT FOUND", gateway.c_str()); + + if(m_logIRCDDB) { + if (!address.empty()) { + CLog::logInfo("GATEWAY: %s %s", gateway.c_str(), address.c_str()); + m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false); + } else { + CLog::logInfo("GATEWAY: %s NOT FOUND", gateway.c_str()); + } } } break; diff --git a/DStarGateway/DStarGatewayThread.h b/DStarGateway/DStarGatewayThread.h index 68b9591..9fc1f02 100644 --- a/DStarGateway/DStarGatewayThread.h +++ b/DStarGateway/DStarGatewayThread.h @@ -65,7 +65,7 @@ public: #ifdef USE_CCS virtual void setCCS(bool enabled, const std::string& host); #endif - virtual void setLog(bool enabled); + virtual void setLog(bool enabled, bool logIRCDDBTraffic); virtual void setAPRSWriters(CAPRSHandler* outgoingAprsWriter, CAPRSHandler* incomingAPRSHandler); virtual void setInfoEnabled(bool enabled); virtual void setEchoEnabled(bool enabled); @@ -118,6 +118,7 @@ private: bool m_echoEnabled; bool m_dtmfEnabled; bool m_logEnabled; + bool m_logIRCDDB; bool m_ddModeEnabled; IRCDDB_STATUS m_lastStatus; CTimer m_statusTimer1; diff --git a/DStarGateway/example.cfg b/DStarGateway/example.cfg index e385857..49a8ef9 100644 --- a/DStarGateway/example.cfg +++ b/DStarGateway/example.cfg @@ -28,7 +28,7 @@ password= enabled=false hostname= username= # The ircDDB username defaults to the value defined for gateway callsign. -password= +password= [ircddb_3] enabled=false @@ -153,6 +153,7 @@ fileRotate= # rotate log files daily, defaults to true fileLevel= # defaults to info, valid values are trace, debug, info, warning, error, fatal, none displayLevel= # defaults to info, valid values are trace, debug, info, warning, error, fatal, none repeatThreshold=#defaults to 2, valid values are disbaled and 1 to 10. Prevents flooding of logs from repeated log messages. +logIRCDDBTraffic=#Set to true to output ircddb traffic to the log, defaults to false [Paths] data=/usr/local/share/dstargateway.d/ # Path where the data (audio files etc) can be found diff --git a/README.md b/README.md index 9b39e10..3a12ab5 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ The testing framwework used is Google Test. # 6. Version History ## 6.1. Version 1.0 +- [**Improvement**] Add Add an option to disable logging of ircddb traffic ([#59](https://github.com/F4FXL/DStarGateway/issues/59)) - [**Bugfix**] Fix repeater not reverting to startup reflector after issueing a command through remote control. ([#57](https://github.com/F4FXL/DStarGateway/issues/57)) - [**Bugfix**] Fix corrupted slow data leading to DV Text Message not being sent to ircddb. Thanks to Manfred DL1JM for all the testing. ([#55](https://github.com/F4FXL/DStarGateway/issues/55)) - [**Improvement**] Add version info to output of --version ([#56](https://github.com/F4FXL/DStarGateway/issues/56))