mirror of
				https://github.com/ShaYmez/NXDNClients.git
				synced 2025-10-31 04:40:21 -04:00 
			
		
		
		
	Add selectable logging levels to the gateway.
This commit is contained in:
		
							parent
							
								
									a3b5c378e1
								
							
						
					
					
						commit
						458255f13e
					
				| @ -62,6 +62,8 @@ m_lookupTime(0U), | ||||
| m_voiceEnabled(true), | ||||
| m_voiceLanguage("en_GB"), | ||||
| m_voiceDirectory(), | ||||
| m_logDisplayLevel(0U), | ||||
| m_logFileLevel(0U), | ||||
| m_logFilePath(), | ||||
| m_logFileRoot(), | ||||
| m_aprsEnabled(false), | ||||
| @ -194,6 +196,10 @@ bool CConf::read() | ||||
| 			  m_logFilePath = value; | ||||
| 		  else if (::strcmp(key, "FileRoot") == 0) | ||||
| 			  m_logFileRoot = value; | ||||
| 		  else if (::strcmp(key, "FileLevel") == 0) | ||||
| 			  m_logFileLevel = (unsigned int)::atoi(value); | ||||
| 		  else if (::strcmp(key, "DisplayLevel") == 0) | ||||
| 			  m_logDisplayLevel = (unsigned int)::atoi(value); | ||||
| 	  } else if (section == SECTION_APRS) { | ||||
| 		  if (::strcmp(key, "Enable") == 0) | ||||
| 			  m_aprsEnabled = ::atoi(value) == 1; | ||||
| @ -353,11 +359,6 @@ std::string CConf::getVoiceDirectory() const | ||||
| 	return m_voiceDirectory; | ||||
| } | ||||
| 
 | ||||
| std::string CConf::getLogFilePath() const | ||||
| { | ||||
|   return m_logFilePath; | ||||
| } | ||||
| 
 | ||||
| bool CConf::getAPRSEnabled() const | ||||
| { | ||||
| 	return m_aprsEnabled; | ||||
| @ -383,6 +384,21 @@ std::string CConf::getAPRSDescription() const | ||||
| 	return m_aprsDescription; | ||||
| } | ||||
| 
 | ||||
| unsigned int CConf::getLogDisplayLevel() const | ||||
| { | ||||
| 	return m_logDisplayLevel; | ||||
| } | ||||
| 
 | ||||
| unsigned int CConf::getLogFileLevel() const | ||||
| { | ||||
| 	return m_logFileLevel; | ||||
| } | ||||
| 
 | ||||
| std::string CConf::getLogFilePath() const | ||||
| { | ||||
| 	return m_logFilePath; | ||||
| } | ||||
| 
 | ||||
| std::string CConf::getLogFileRoot() const | ||||
| { | ||||
| 	return m_logFileRoot; | ||||
|  | ||||
| @ -67,6 +67,8 @@ public: | ||||
|   std::string  getAPRSDescription() const; | ||||
| 
 | ||||
|   // The Log section
 | ||||
|   unsigned int getLogDisplayLevel() const; | ||||
|   unsigned int getLogFileLevel() const; | ||||
|   std::string  getLogFilePath() const; | ||||
|   std::string  getLogFileRoot() const; | ||||
| 
 | ||||
| @ -119,6 +121,8 @@ private: | ||||
|   std::string  m_voiceLanguage; | ||||
|   std::string  m_voiceDirectory; | ||||
| 
 | ||||
|   unsigned int m_logDisplayLevel; | ||||
|   unsigned int m_logFileLevel; | ||||
|   std::string  m_logFilePath; | ||||
|   std::string  m_logFileRoot; | ||||
| 
 | ||||
|  | ||||
| @ -164,7 +164,7 @@ void CNXDNGateway::run() | ||||
| 	} | ||||
| #endif | ||||
| 
 | ||||
| 	ret = ::LogInitialise(m_conf.getLogFilePath(), m_conf.getLogFileRoot(), 1U, 1U); | ||||
| 	ret = ::LogInitialise(m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); | ||||
| 	if (!ret) { | ||||
| 		::fprintf(stderr, "NXDNGateway: unable to open the log file\n"); | ||||
| 		return; | ||||
|  | ||||
| @ -46,6 +46,9 @@ Name=NXDN.csv | ||||
| Time=24 | ||||
| 
 | ||||
| [Log] | ||||
| # Logging levels, 0=No logging | ||||
| DisplayLevel=1 | ||||
| FileLevel=1 | ||||
| FilePath=. | ||||
| FileRoot=NXDNGateway | ||||
| 
 | ||||
|  | ||||
| @ -19,6 +19,6 @@ | ||||
| #if !defined(VERSION_H) | ||||
| #define	VERSION_H | ||||
| 
 | ||||
| const char* VERSION = "20200701"; | ||||
| const char* VERSION = "20200824"; | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user