Changing RotateLogs to TimestampLogs
This commit is contained in:
parent
53ae146667
commit
7a5bbda248
10
Conf.cpp
10
Conf.cpp
|
@ -82,7 +82,7 @@ m_logDisplayLevel(0U),
|
|||
m_logFileLevel(0U),
|
||||
m_logFilePath(),
|
||||
m_logFileRoot(),
|
||||
m_logRotateLogs(1U),
|
||||
m_logTimestampLogs(1U),
|
||||
m_cwIdEnabled(false),
|
||||
m_cwIdTime(10U),
|
||||
m_cwIdCallsign(),
|
||||
|
@ -454,8 +454,8 @@ bool CConf::read()
|
|||
m_logFileLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "DisplayLevel") == 0)
|
||||
m_logDisplayLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "RotateLogs") == 0)
|
||||
m_logRotateLogs = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "TimestampLogs") == 0)
|
||||
m_logTimestampLogs = (unsigned int)::atoi(value);
|
||||
} else if (section == SECTION_CWID) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_cwIdEnabled = ::atoi(value) == 1;
|
||||
|
@ -1077,9 +1077,9 @@ std::string CConf::getLogFileRoot() const
|
|||
return m_logFileRoot;
|
||||
}
|
||||
|
||||
unsigned int CConf::getLogRotateLogs() const
|
||||
unsigned int CConf::getLogTimestampLogs() const
|
||||
{
|
||||
return m_logRotateLogs;
|
||||
return m_logTimestampLogs;
|
||||
}
|
||||
|
||||
bool CConf::getCWIdEnabled() const
|
||||
|
|
4
Conf.h
4
Conf.h
|
@ -54,7 +54,7 @@ public:
|
|||
unsigned int getLogFileLevel() const;
|
||||
std::string getLogFilePath() const;
|
||||
std::string getLogFileRoot() const;
|
||||
unsigned int getLogRotateLogs() const;
|
||||
unsigned int getLogTimestampLogs() const;
|
||||
|
||||
// The CW ID section
|
||||
bool getCWIdEnabled() const;
|
||||
|
@ -338,7 +338,7 @@ private:
|
|||
unsigned int m_logFileLevel;
|
||||
std::string m_logFilePath;
|
||||
std::string m_logFileRoot;
|
||||
unsigned int m_logRotateLogs;
|
||||
unsigned int m_logTimestampLogs;
|
||||
|
||||
bool m_cwIdEnabled;
|
||||
unsigned int m_cwIdTime;
|
||||
|
|
8
Log.cpp
8
Log.cpp
|
@ -41,7 +41,7 @@ static bool m_daemon = false;
|
|||
|
||||
static unsigned int m_displayLevel = 2U;
|
||||
|
||||
static unsigned int m_rotateLogs = 1U;
|
||||
static unsigned int m_timestampLogs = 1U;
|
||||
|
||||
static struct tm m_tm;
|
||||
|
||||
|
@ -70,7 +70,7 @@ static bool LogOpen()
|
|||
char filename[200U];
|
||||
char timestamp[37U] = "";
|
||||
|
||||
if (m_rotateLogs) {
|
||||
if (m_timestampLogs) {
|
||||
::sprintf(timestamp, "-%04d-%02d-%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
||||
}
|
||||
|
||||
|
@ -94,13 +94,13 @@ static bool LogOpen()
|
|||
return status;
|
||||
}
|
||||
|
||||
bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, unsigned int rotateLogs)
|
||||
bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, unsigned int timestampLogs)
|
||||
{
|
||||
m_filePath = filePath;
|
||||
m_fileRoot = fileRoot;
|
||||
m_fileLevel = fileLevel;
|
||||
m_displayLevel = displayLevel;
|
||||
m_rotateLogs = rotateLogs;
|
||||
m_timestampLogs = timestampLogs;
|
||||
m_daemon = daemon;
|
||||
|
||||
if (m_daemon)
|
||||
|
|
2
Log.h
2
Log.h
|
@ -30,7 +30,7 @@
|
|||
|
||||
extern void Log(unsigned int level, const char* fmt, ...);
|
||||
|
||||
extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, unsigned int rotateLogs);
|
||||
extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, unsigned int timestampLogs);
|
||||
extern void LogFinalise();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@ DisplayLevel=1
|
|||
FileLevel=1
|
||||
FilePath=.
|
||||
FileRoot=MMDVM
|
||||
RotateLogs=1
|
||||
TimestampLogs=1
|
||||
|
||||
[CW Id]
|
||||
Enable=1
|
||||
|
|
|
@ -242,9 +242,9 @@ int CMMDVMHost::run()
|
|||
#endif
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogRotateLogs());
|
||||
ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogTimestampLogs());
|
||||
#else
|
||||
ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogRotateLogs());
|
||||
ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogTimestampLogs());
|
||||
#endif
|
||||
if (!ret) {
|
||||
::fprintf(stderr, "MMDVMHost: unable to open the log file\n");
|
||||
|
|
Loading…
Reference in a new issue