Allow the logging levels to be configurable in the gateway.

This commit is contained in:
Jonathan Naylor 2020-08-24 10:16:02 +01:00
parent 6bfe9c6500
commit 9992e7125f
5 changed files with 27 additions and 4 deletions

View File

@ -48,6 +48,8 @@ m_lookupTime(0U),
m_voiceEnabled(true),
m_voiceLanguage("en_GB"),
m_voiceDirectory(),
m_logDisplayLevel(0U),
m_logFileLevel(0U),
m_logFilePath(),
m_logFileRoot(),
m_networkPort(0U),
@ -138,6 +140,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_NETWORK) {
if (::strcmp(key, "Port") == 0)
m_networkPort = (unsigned int)::atoi(value);
@ -224,14 +230,24 @@ std::string CConf::getVoiceDirectory() const
return m_voiceDirectory;
}
unsigned int CConf::getLogDisplayLevel() const
{
return m_logDisplayLevel;
}
unsigned int CConf::getLogFileLevel() const
{
return m_logFileLevel;
}
std::string CConf::getLogFilePath() const
{
return m_logFilePath;
return m_logFilePath;
}
std::string CConf::getLogFileRoot() const
{
return m_logFileRoot;
return m_logFileRoot;
}
unsigned int CConf::getNetworkPort() const

View File

@ -47,6 +47,8 @@ public:
std::string getVoiceDirectory() const;
// The Log section
unsigned int getLogDisplayLevel() const;
unsigned int getLogFileLevel() const;
std::string getLogFilePath() const;
std::string getLogFileRoot() const;
@ -82,6 +84,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;

View File

@ -153,7 +153,7 @@ void CP25Gateway::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, "P25Gateway: unable to open the log file\n");
return;

View File

@ -15,6 +15,9 @@ Language=en_GB
Directory=./Audio
[Log]
# Logging levels, 0=No logging
DisplayLevel=1
FileLevel=1
FilePath=.
FileRoot=P25Gateway

View File

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200403";
const char* VERSION = "20200824";
#endif