diff --git a/src/bridge/HostBridge.cpp b/src/bridge/HostBridge.cpp index 3137880c..39bceda2 100644 --- a/src/bridge/HostBridge.cpp +++ b/src/bridge/HostBridge.cpp @@ -2488,7 +2488,7 @@ uint8_t* HostBridge::generateRTPHeaders(uint8_t msgLen, uint16_t& rtpSeq) if (timestamp != INVALID_TS) { timestamp += (RTP_GENERIC_CLOCK_RATE / 50); if (m_debug) - LogDebug(LOG_NET, "HostBridge::generateRTPHeaders() RTP, previous TS = %u, TS = %u, rtpSeq = %u", m_rtpTimestamp, timestamp, rtpSeq); + LogDebugEx(LOG_NET, "HostBridge::generateRTPHeaders()", "RTP, previous TS = %u, TS = %u, rtpSeq = %u", m_rtpTimestamp, timestamp, rtpSeq); m_rtpTimestamp = timestamp; } @@ -2507,7 +2507,7 @@ uint8_t* HostBridge::generateRTPHeaders(uint8_t msgLen, uint16_t& rtpSeq) if (timestamp == INVALID_TS) { if (m_debug) - LogDebug(LOG_NET, "HostBridge::generateRTPHeaders() RTP, initial TS = %u, rtpSeq = %u", header.getTimestamp(), rtpSeq); + LogDebugEx(LOG_NET, "HostBridge::generateRTPHeaders()", "RTP, initial TS = %u, rtpSeq = %u", header.getTimestamp(), rtpSeq); m_rtpTimestamp = header.getTimestamp(); } @@ -2608,7 +2608,7 @@ void* HostBridge::threadAudioProcess(void* arg) HostBridge* bridge = static_cast(th->obj); if (bridge == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -2616,7 +2616,7 @@ void* HostBridge::threadAudioProcess(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -2737,7 +2737,7 @@ void* HostBridge::threadAudioProcess(void* arg) Thread::sleep(1U); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -2760,7 +2760,7 @@ void* HostBridge::threadNetworkProcess(void* arg) HostBridge* bridge = static_cast(th->obj); if (bridge == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -2768,7 +2768,7 @@ void* HostBridge::threadNetworkProcess(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -2800,7 +2800,7 @@ void* HostBridge::threadNetworkProcess(void* arg) Thread::sleep(1U); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -2823,7 +2823,7 @@ void* HostBridge::threadCallWatchdog(void* arg) HostBridge* bridge = static_cast(th->obj); if (bridge == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -2831,7 +2831,7 @@ void* HostBridge::threadCallWatchdog(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -2885,7 +2885,7 @@ void* HostBridge::threadCallWatchdog(void* arg) Thread::sleep(5U); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/common/AESCrypto.cpp b/src/common/AESCrypto.cpp index 1638304c..fc582076 100644 --- a/src/common/AESCrypto.cpp +++ b/src/common/AESCrypto.cpp @@ -266,7 +266,7 @@ AES::AES(const AESKeyLength keyLength) { uint8_t* AES::encryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::encryptECB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::encryptECB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } @@ -289,7 +289,7 @@ uint8_t* AES::encryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[] uint8_t* AES::decryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::decryptECB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::decryptECB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } @@ -312,7 +312,7 @@ uint8_t* AES::decryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[] uint8_t* AES::encryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t* iv) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::encryptCBC() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::encryptCBC()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } @@ -339,7 +339,7 @@ uint8_t* AES::encryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[] uint8_t* AES::decryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::decryptCBC() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::decryptCBC()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } @@ -366,7 +366,7 @@ uint8_t* AES::decryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[] uint8_t* AES::encryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::encryptCFB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::encryptCFB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } @@ -394,7 +394,7 @@ uint8_t* AES::encryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[] uint8_t* AES::decryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) { if (inLen % BLOCK_BYTES_LEN != 0) { - LogDebug(LOG_HOST, "AES::decryptCFB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); + LogDebugEx(LOG_HOST, "AES::decryptCFB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); return nullptr; } diff --git a/src/common/Log.cpp b/src/common/Log.cpp index 7399a8b8..01553284 100644 --- a/src/common/Log.cpp +++ b/src/common/Log.cpp @@ -5,7 +5,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX - * Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL * */ #include "Log.h" @@ -201,7 +201,7 @@ void LogFinalise() /* Writes a new entry to the diagnostics log. */ -void Log(uint32_t level, const char *module, const char* fmt, ...) +void Log(uint32_t level, const char *module, const char* file, const int lineNo, const char* func, const char* fmt, ...) { assert(fmt != nullptr); #if defined(CATCH2_TEST_COMPILATION) @@ -217,22 +217,83 @@ void Log(uint32_t level, const char *module, const char* fmt, ...) ::gettimeofday(&nowMillis, NULL); if (module != nullptr) { - ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module); + // level 1 is DEBUG + if (level == 1U) { + // if we have a file and line number -- add that to the log entry + if (file != nullptr && lineNo > 0) { + // if we have a function name add that to the log entry + if (func != nullptr) { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s)[%s:%u][%s] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module, file, lineNo, func); + } + else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s)[%s:%u] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module, file, lineNo); + } + } else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module); + } + } else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module); + } } else { - ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U); + // level 1 is DEBUG + if (level == 1U) { + // if we have a file and line number -- add that to the log entry + if (file != nullptr && lineNo > 0) { + // if we have a function name add that to the log entry + if (func != nullptr) { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu [%s:%u][%s] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, file, lineNo, func); + } + else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu [%s:%u] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, file, lineNo); + } + } else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U); + } + } else { + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U); + } } } else { if (module != nullptr) { - ::sprintf(buffer, "%c: (%s) ", LEVELS[level], module); + // level 1 is DEBUG + if (level == 1U) { + // if we have a file and line number -- add that to the log entry + if (file != nullptr && lineNo > 0) { + // if we have a function name add that to the log entry + if (func != nullptr) { + ::sprintf(buffer, "%c: (%s)[%s:%u][%s] ", LEVELS[level], module, file, lineNo, func); + } + else { + ::sprintf(buffer, "%c: (%s)[%s:%u] ", LEVELS[level], module, file, lineNo); + } + } + else { + ::sprintf(buffer, "%c: (%s) ", LEVELS[level], module); + } + } else { + ::sprintf(buffer, "%c: (%s) ", LEVELS[level], module); + } } else { if (level >= 9999U) { ::sprintf(buffer, "U: "); } else { - ::sprintf(buffer, "%c: ", LEVELS[level]); + // if we have a file and line number -- add that to the log entry + if (file != nullptr && lineNo > 0) { + // if we have a function name add that to the log entry + if (func != nullptr) { + ::sprintf(buffer, "%c: [%s:%u][%s] ", LEVELS[level], file, lineNo, func); + } + else { + ::sprintf(buffer, "%c: [%s:%u] ", LEVELS[level], file, lineNo); + } + } + else { + ::sprintf(buffer, "%c: ", LEVELS[level]); + } } } } diff --git a/src/common/Log.h b/src/common/Log.h index 62c7a7bc..2087b808 100644 --- a/src/common/Log.h +++ b/src/common/Log.h @@ -5,7 +5,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX - * Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL * */ /** @@ -62,7 +62,16 @@ * * This is a variable argument function. */ -#define LogDebug(_module, fmt, ...) Log(1U, _module, fmt, ##__VA_ARGS__) +#define LogDebug(_module, fmt, ...) Log(1U, _module, __FILE__, __LINE__, nullptr, fmt, ##__VA_ARGS__) +/** + * @brief Macro helper to create a debug log entry. + * @param _module Name of module generating log entry. + * @param _func Name of function generating log entry. + * @param fmt String format. + * + * This is a variable argument function. + */ +#define LogDebugEx(_module, _func, fmt, ...) Log(1U, _module, __FILE__, __LINE__, _func, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a message log entry. * @param _module Name of module generating log entry. @@ -70,7 +79,7 @@ * * This is a variable argument function. */ -#define LogMessage(_module, fmt, ...) Log(2U, _module, fmt, ##__VA_ARGS__) +#define LogMessage(_module, fmt, ...) Log(2U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a informational log entry. * @param _module Name of module generating log entry. @@ -79,7 +88,7 @@ * This is a variable argument function. LogInfo() does not use a module * name when creating a log entry. */ -#define LogInfo(fmt, ...) Log(3U, nullptr, fmt, ##__VA_ARGS__) +#define LogInfo(fmt, ...) Log(3U, nullptr, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a informational log entry with module name. * @param _module Name of module generating log entry. @@ -87,7 +96,7 @@ * * This is a variable argument function. */ -#define LogInfoEx(_module, fmt, ...) Log(3U, _module, fmt, ##__VA_ARGS__) +#define LogInfoEx(_module, fmt, ...) Log(3U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a warning log entry. * @param _module Name of module generating log entry. @@ -95,7 +104,7 @@ * * This is a variable argument function. */ -#define LogWarning(_module, fmt, ...) Log(4U, _module, fmt, ##__VA_ARGS__) +#define LogWarning(_module, fmt, ...) Log(4U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a error log entry. * @param _module Name of module generating log entry. @@ -103,7 +112,7 @@ * * This is a variable argument function. */ -#define LogError(_module, fmt, ...) Log(5U, _module, fmt, ##__VA_ARGS__) +#define LogError(_module, fmt, ...) Log(5U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) /** * @brief Macro helper to create a fatal log entry. * @param _module Name of module generating log entry. @@ -111,7 +120,7 @@ * * This is a variable argument function. */ -#define LogFatal(_module, fmt, ...) Log(6U, _module, fmt, ##__VA_ARGS__) +#define LogFatal(_module, fmt, ...) Log(6U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__) // --------------------------------------------------------------------------- // Externs @@ -186,11 +195,14 @@ extern HOST_SW_API void LogFinalise(); * @brief Writes a new entry to the diagnostics log. * @param level Log level for entry. * @param module Name of module generating log entry. + * @param file Name of source code file generating log entry. + * @param line Line number in source code file generating log entry. + * @param func Name of function generating log entry. * @param fmt String format. * - * This is a variable argument function. + * This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead. */ -extern HOST_SW_API void Log(uint32_t level, const char* module, const char* fmt, ...); +extern HOST_SW_API void Log(uint32_t level, const char* module, const char* file, const int lineNo, const char* func, const char* fmt, ...); /** @} */ #endif // __LOG_H__ diff --git a/src/common/RingBuffer.h b/src/common/RingBuffer.h index c390c7f4..c8076935 100644 --- a/src/common/RingBuffer.h +++ b/src/common/RingBuffer.h @@ -82,7 +82,7 @@ public: m_iPtr = 0U; } #if DEBUG_RINGBUFFER - LogDebug(LOG_HOST, "RingBuffer::addData(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name, iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite)); + LogDebugEx(LOG_HOST, "RingBuffer::addData()", "(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name, iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite)); #endif return true; } @@ -109,7 +109,7 @@ public: m_oPtr = 0U; } #if DEBUG_RINGBUFFER - LogDebug(LOG_HOST, "RingBuffer::getData(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name, m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead)); + LogDebugEx(LOG_HOST, "RingBuffer::getData()", "(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name, m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead)); #endif return true; } diff --git a/src/common/Utils.cpp b/src/common/Utils.cpp index 74cfbe3e..12ac2e8d 100644 --- a/src/common/Utils.cpp +++ b/src/common/Utils.cpp @@ -5,7 +5,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright (C) 2009,2014,2015,2016 Jonathan Naylor, G4KLX - * Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL * */ #include "Utils.h" @@ -72,7 +72,7 @@ void Utils::dump(int level, const std::string& title, const uint8_t* data, uint3 { assert(data != nullptr); - ::Log(level, "DUMP", "%s (len %u)", title.c_str(), length); + ::Log(level, "DUMP", nullptr, 0, nullptr, "%s (len %u)", title.c_str(), length); uint32_t offset = 0U; @@ -103,7 +103,7 @@ void Utils::dump(int level, const std::string& title, const uint8_t* data, uint3 output += '*'; #endif - ::Log(level, "DUMP", "%04X: %s", offset, output.c_str()); + ::Log(level, "DUMP", nullptr, 0, nullptr, "%04X: %s", offset, output.c_str()); offset += 16U; @@ -143,7 +143,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng { assert(data != nullptr); - ::Log(2U, "SYMBOLS", "%s (len %u)", title.c_str(), length); + ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "%s (len %u)", title.c_str(), length); uint32_t offset = 0U; uint32_t count = 0U; @@ -158,7 +158,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng microslotHeader += temp; } - ::Log(2U, "SYMBOLS", "MCR: %s", microslotHeader.c_str()); + ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "MCR: %s", microslotHeader.c_str()); uint32_t bufLen = length; while (bufLen > 0U) { @@ -188,7 +188,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng symOffset += 9; } - ::Log(2U, "SYMBOLS", "%03u: %s", count, output.c_str()); + ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "%03u: %s", count, output.c_str()); offset += 18U; count += 2U; diff --git a/src/common/edac/AMBEFEC.cpp b/src/common/edac/AMBEFEC.cpp index 4fc3f393..17c20f40 100644 --- a/src/common/edac/AMBEFEC.cpp +++ b/src/common/edac/AMBEFEC.cpp @@ -571,7 +571,7 @@ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const if (!valid) { uint32_t errsA = Utils::countBits32(data ^ a); #if DEBUG_AMBEFEC - LogDebug(LOG_HOST, "AMBEFEC::regnerate() invalid A block, errsA = %u, a = %6X, b = %6X, c = %6X", errsA, a, b, c); + LogDebugEx(LOG_HOST, "AMBEFEC::regnerate()", "invalid A block, errsA = %u, a = %6X, b = %6X, c = %6X", errsA, a, b, c); #endif a = 0xF00292U; b = 0x0E0B20U; @@ -596,7 +596,7 @@ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const v = b ^ old_b; uint32_t errsB = Utils::countBits32(v); #if DEBUG_AMBEFEC - LogDebug(LOG_HOST, "AMBEFEC::regnerate() errsA = %u, a = %6X, errsB = %u, b = %6X, c = %6X", errsA, a, errsB, b, c); + LogDebugEx(LOG_HOST, "AMBEFEC::regnerate()", "errsA = %u, a = %6X, errsB = %u, b = %6X, c = %6X", errsA, a, errsB, b, c); #endif if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) { a = 0xF00292U; diff --git a/src/common/edac/CRC.cpp b/src/common/edac/CRC.cpp index a415d986..b4f6a852 100644 --- a/src/common/edac/CRC.cpp +++ b/src/common/edac/CRC.cpp @@ -202,7 +202,7 @@ bool CRC::checkCCITT162(const uint8_t *in, uint32_t length) #if DEBUG_CRC_CHECK uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0); - LogDebug(LOG_HOST, "CRC::checkCCITT162(), crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); + LogDebugEx(LOG_HOST, "CRC::checkCCITT162()", "crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); #endif return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U]; @@ -228,7 +228,7 @@ void CRC::addCCITT162(uint8_t* in, uint32_t length) crc16 = ~crc16; #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCCITT162(), crc = $%04X, len = %u", crc16, length); + LogDebugEx(LOG_HOST, "CRC::addCCITT162()", "crc = $%04X, len = %u", crc16, length); #endif in[length - 1U] = crc8[0U]; @@ -256,7 +256,7 @@ bool CRC::checkCCITT161(const uint8_t *in, uint32_t length) #if DEBUG_CRC_CHECK uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0); - LogDebug(LOG_HOST, "CRC::checkCCITT161(), crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); + LogDebugEx(LOG_HOST, "CRC::checkCCITT161()", "crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); #endif return crc8[0U] == in[length - 2U] && crc8[1U] == in[length - 1U]; @@ -282,7 +282,7 @@ void CRC::addCCITT161(uint8_t* in, uint32_t length) crc16 = ~crc16; #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCCITT161(), crc = $%04X, len = %u", crc16, length); + LogDebugEx(LOG_HOST, "CRC::addCCITT161()", "crc = $%04X, len = %u", crc16, length); #endif in[length - 2U] = crc8[0U]; @@ -314,7 +314,7 @@ bool CRC::checkCRC32(const uint8_t *in, uint32_t length) #if DEBUG_CRC_CHECK uint32_t inCrc = (in[length - 4U] << 24) | (in[length - 3U] << 16) | (in[length - 2U] << 8) | (in[length - 1U] << 0); - LogDebug(LOG_HOST, "CRC::checkCRC32(), crc = $%08X, in = $%08X, len = %u", crc32, inCrc, length); + LogDebugEx(LOG_HOST, "CRC::checkCRC32()", "crc = $%08X, in = $%08X, len = %u", crc32, inCrc, length); #endif return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U] && crc8[2U] == in[length - 3U] && crc8[3U] == in[length - 4U]; @@ -344,7 +344,7 @@ void CRC::addCRC32(uint8_t* in, uint32_t length) crc32 &= 0xFFFFFFFFU; #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCRC32(), crc = $%08X, len = %u", crc32, length); + LogDebugEx(LOG_HOST, "CRC::addCRC32()", "crc = $%08X, len = %u", crc32, length); #endif in[length - 1U] = crc8[0U]; @@ -365,7 +365,7 @@ uint8_t CRC::crc8(const uint8_t *in, uint32_t length) crc = CRC8_TABLE[crc ^ in[i]]; #if DEBUG_CRC_CHECK - LogDebug(LOG_HOST, "CRC::crc8(), crc = $%02X, len = %u", crc, length); + LogDebugEx(LOG_HOST, "CRC::crc8()", "crc = $%02X, len = %u", crc, length); #endif return crc; @@ -389,7 +389,7 @@ bool CRC::checkCRC6(const uint8_t* in, uint32_t bitLength) #if DEBUG_CRC_CHECK uint32_t inCrc = temp[0U]; - LogDebug(LOG_HOST, "CRC::checkCRC6(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); + LogDebugEx(LOG_HOST, "CRC::checkCRC6()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); #endif return crc == temp[0U]; @@ -411,7 +411,7 @@ uint8_t CRC::addCRC6(uint8_t* in, uint32_t bitLength) } #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCRC6(), crc = $%04X, bitlen = %u", crc[0U], bitLength); + LogDebugEx(LOG_HOST, "CRC::addCRC6()", "crc = $%04X, bitlen = %u", crc[0U], bitLength); #endif return crc[0U]; } @@ -438,7 +438,7 @@ bool CRC::checkCRC12(const uint8_t* in, uint32_t bitLength) #if DEBUG_CRC_CHECK uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); - LogDebug(LOG_HOST, "CRC:checkCRC12(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); + LogDebugEx(LOG_HOST, "CRC:checkCRC12()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); #endif return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; @@ -463,7 +463,7 @@ uint16_t CRC::addCRC12(uint8_t* in, uint32_t bitLength) } #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCRC12(), crc = $%04X, bitlen = %u", crc, bitLength); + LogDebugEx(LOG_HOST, "CRC::addCRC12()", "crc = $%04X, bitlen = %u", crc, bitLength); #endif return crc; } @@ -490,7 +490,7 @@ bool CRC::checkCRC15(const uint8_t* in, uint32_t bitLength) #if DEBUG_CRC_CHECK uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); - LogDebug(LOG_HOST, "CRC:checkCRC15(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); + LogDebugEx(LOG_HOST, "CRC:checkCRC15()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); #endif return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; @@ -515,7 +515,7 @@ uint16_t CRC::addCRC15(uint8_t* in, uint32_t bitLength) } #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCRC15(), crc = $%04X, bitlen = %u", crc, bitLength); + LogDebugEx(LOG_HOST, "CRC::addCRC15()", "crc = $%04X, bitlen = %u", crc, bitLength); #endif return crc; } @@ -542,7 +542,7 @@ bool CRC::checkCRC16(const uint8_t* in, uint32_t bitLength) #if DEBUG_CRC_CHECK uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); - LogDebug(LOG_HOST, "CRC:checkCRC16(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); + LogDebugEx(LOG_HOST, "CRC:checkCRC16()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); #endif return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; @@ -567,7 +567,7 @@ uint16_t CRC::addCRC16(uint8_t* in, uint32_t bitLength) } #if DEBUG_CRC_ADD - LogDebug(LOG_HOST, "CRC::addCRC16(), crc = $%04X, bitlen = %u", crc, bitLength); + LogDebugEx(LOG_HOST, "CRC::addCRC16()", "crc = $%04X, bitlen = %u", crc, bitLength); #endif return crc; } diff --git a/src/common/edac/RS634717.cpp b/src/common/edac/RS634717.cpp index cc8240a3..4ad9b2cb 100644 --- a/src/common/edac/RS634717.cpp +++ b/src/common/edac/RS634717.cpp @@ -155,7 +155,7 @@ bool RS634717::decode241213(uint8_t* data) int ec = rs241213.decode(codeword); #if DEBUG_RS - LogDebug(LOG_HOST, "RS634717::decode241213(), errors = %d", ec); + LogDebugEx(LOG_HOST, "RS634717::decode241213()", "errors = %d", ec); #endif offset = 0U; for (uint32_t i = 0U; i < 12U; i++, offset += 6) @@ -205,7 +205,7 @@ bool RS634717::decode24169(uint8_t* data) int ec = rs24169.decode(codeword); #if DEBUG_RS - LogDebug(LOG_HOST, "RS634717::decode24169(), errors = %d\n", ec); + LogDebugEx(LOG_HOST, "RS634717::decode24169()", "errors = %d\n", ec); #endif offset = 0U; for (uint32_t i = 0U; i < 16U; i++, offset += 6) @@ -255,7 +255,7 @@ bool RS634717::decode362017(uint8_t* data) int ec = rs634717.decode(codeword); #if DEBUG_RS - LogDebug(LOG_HOST, "RS634717::decode362017(), errors = %d\n", ec); + LogDebugEx(LOG_HOST, "RS634717::decode362017()", "errors = %d\n", ec); #endif offset = 0U; for (uint32_t i = 0U; i < 20U; i++, offset += 6) diff --git a/src/common/edac/Trellis.cpp b/src/common/edac/Trellis.cpp index 2ab37994..c5992c17 100644 --- a/src/common/edac/Trellis.cpp +++ b/src/common/edac/Trellis.cpp @@ -453,7 +453,7 @@ void Trellis::dibitsToBits(const uint8_t* dibits, uint8_t* payload) const bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) const { #if DEBUG_TRELLIS - ::LogDebug(LOG_HOST, "Trellis::fixCode34() failPos = %u, val = %01X", failPos, points[failPos]); + ::LogDebugEx(LOG_HOST, "Trellis::fixCode34()", "failPos = %u, val = %01X", failPos, points[failPos]); #endif for (unsigned j = 0U; j < 20U; j++) { uint32_t bestPos = 0U; @@ -466,7 +466,7 @@ bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) con uint32_t pos = checkCode34(points, tribits); if (pos == 999U) { #if DEBUG_TRELLIS - ::LogDebug(LOG_HOST, "Trellis::fixCode34() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); + ::LogDebugEx(LOG_HOST, "Trellis::fixCode34()", "fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); #endif tribitsToBits(tribits, payload); return true; @@ -519,7 +519,7 @@ uint32_t Trellis::checkCode34(const uint8_t* points, uint8_t* tribits) const bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) const { #if DEBUG_TRELLIS - ::LogDebug(LOG_HOST, "Trellis::fixCode12() failPos = %u, val = %01X", failPos, points[failPos]); + ::LogDebugEx(LOG_HOST, "Trellis::fixCode12()", "failPos = %u, val = %01X", failPos, points[failPos]); #endif for (unsigned j = 0U; j < 20U; j++) { uint32_t bestPos = 0U; @@ -532,7 +532,7 @@ bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) con uint32_t pos = checkCode12(points, dibits); if (pos == 999U) { #if DEBUG_TRELLIS - ::LogDebug(LOG_HOST, "Trellis::fixCode12() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); + ::LogDebugEx(LOG_HOST, "Trellis::fixCode12()", "fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); #endif dibitsToBits(dibits, payload); return true; diff --git a/src/common/edac/rs/RS.h b/src/common/edac/rs/RS.h index 51f83365..54673317 100755 --- a/src/common/edac/rs/RS.h +++ b/src/common/edac/rs/RS.h @@ -338,7 +338,7 @@ namespace edac return; } #if DEBUG_RS - LogDebug(LOG_HOST, "reed_solomon_tabs::reed_solomon_tabs() RS(%d,*): initialized for %d symbols size, %d modulo table", SIZE, NN, MODS); + LogDebugEx(LOG_HOST, "reed_solomon_tabs::reed_solomon_tabs()", "RS(%d,*): initialized for %d symbols size, %d modulo table", SIZE, NN, MODS); #endif // Generate Galois field lookup tables index_of[0] = A0; // log(zero) = -inf @@ -478,7 +478,7 @@ namespace edac return; } #if DEBUG_RS - LogDebug(LOG_HOST, "reed_solomon::reed_solomon() RS(%d,%d): initialized for %d roots", SIZE, LOAD, NROOTS); + LogDebugEx(LOG_HOST, "reed_solomon::reed_solomon()", "RS(%d,%d): initialized for %d roots", SIZE, LOAD, NROOTS); #endif std::array tmppoly; // uninitialized @@ -896,25 +896,25 @@ namespace edac } if (count != no_eras) { - LogDebug(LOG_HOST, "reed_solomon::decode(): count = %d, no_eras = %d, lambda(x) is WRONG", count, no_eras); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "count = %d, no_eras = %d, lambda(x) is WRONG", count, no_eras); count = -1; goto finish; } if (count) { std::stringstream ss; - ss << "reed_solomon::decode(): Erasure positions as determined by roots of Eras Loc Poly: "; + ss << "Erasure positions as determined by roots of Eras Loc Poly: "; for (int i = 0; i < count; i++) { ss << loc[i] << ' '; } - LogDebug(LOG_HOST, "%s", ss.str().c_str()); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str()); ss.clear(); - ss << "reed_solomon::decode(): Erasure positions as determined by roots of eras_pos array: "; + ss << "Erasure positions as determined by roots of eras_pos array: "; for (int i = 0; i < no_eras; i++) { ss << eras_pos[i] << ' '; } - LogDebug(LOG_HOST, "%s", ss.str().c_str()); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str()); } #endif @@ -1052,7 +1052,7 @@ namespace edac #if DEBUG_RS if (den == 0) { - LogDebug(LOG_HOST, "reed_solomon::decode(): ERROR: denominator = 0"); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "ERROR: denominator = 0"); count = -1; goto finish; } @@ -1066,9 +1066,9 @@ namespace edac // correction location outside of the data and parity we've been provided! #if DEBUG_RS std::stringstream ss; - ss << "reed_solomon::decode(): ERROR: RS(" << SIZE <<"," << LOAD << ") computed error location: " << loc[j] << + ss << "ERROR: RS(" << SIZE <<"," << LOAD << ") computed error location: " << loc[j] << " within " << pad << " pad symbols, not within " << LOAD - pad << " data or " << NROOTS << " parity"; - LogDebug(LOG_HOST, "%s", ss.str().c_str()); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str()); #endif count = -1; goto finish; @@ -1098,7 +1098,7 @@ namespace edac finish: #if DEBUG_RS if (count > NROOTS) { - LogDebug(LOG_HOST, "reed_solomon::decode(): ERROR: number of corrections %d exceeds NROOTS %d", count, NROOTS); + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "ERROR: number of corrections %d exceeds NROOTS %d", count, NROOTS); } if (count > 0) { @@ -1114,8 +1114,8 @@ finish: } std::stringstream ss; - ss << "reed_solomon::decode(): e)rase, E)rror; count = " << count << ": " << std::endl << errors; - LogDebug(LOG_HOST, "%s", ss.str().c_str()); + ss << "e)rase, E)rror; count = " << count << ": " << std::endl << errors; + LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str()); } #endif if (eras_pos != NULL) { diff --git a/src/common/lookups/PeerListLookup.cpp b/src/common/lookups/PeerListLookup.cpp index f64d131c..454e07c3 100644 --- a/src/common/lookups/PeerListLookup.cpp +++ b/src/common/lookups/PeerListLookup.cpp @@ -221,7 +221,7 @@ bool PeerListLookup::load() m_table[id] = PeerId(id, alias, password, peerLink, false); // Log depending on what was loaded - LogDebug(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s", id, + LogMessage(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s", id, (!alias.empty() ? (" (" + alias + ")").c_str() : ""), (!password.empty() ? "using unique peer password" : "using master password"), (peerLink) ? ", Peer-Link Enabled" : ""); @@ -242,8 +242,6 @@ bool PeerListLookup::load() bool PeerListLookup::save() { - LogDebug(LOG_HOST, "Saving peer lookup file to %s", m_filename.c_str()); - if (m_filename.empty()) { return false; } @@ -254,6 +252,8 @@ bool PeerListLookup::save() return false; } + LogMessage(LOG_HOST, "Saving peer lookup file to %s", m_filename.c_str()); + // Counter for lines written unsigned int lines = 0; diff --git a/src/common/lookups/RadioIdLookup.cpp b/src/common/lookups/RadioIdLookup.cpp index 86797533..4a02c3c6 100644 --- a/src/common/lookups/RadioIdLookup.cpp +++ b/src/common/lookups/RadioIdLookup.cpp @@ -195,11 +195,6 @@ bool RadioIdLookup::load() } m_table[id] = RadioId(radioEnabled, false, alias, ipAddress); - /*if (alias != "") { - LogDebug(LOG_HOST, "Loaded RID %u (%s) into RID lookup table", id, parsed[2].c_str()); - } else { - LogDebug(LOG_HOST, "Loaded RID %u into RID lookup table", id); - }*/ } } @@ -218,8 +213,6 @@ bool RadioIdLookup::load() bool RadioIdLookup::save() { - LogDebug(LOG_HOST, "Saving RID lookup file to %s", m_filename.c_str()); - if (m_filename.empty()) { return false; } @@ -230,6 +223,8 @@ bool RadioIdLookup::save() return false; } + LogMessage(LOG_HOST, "Saving RID lookup file to %s", m_filename.c_str()); + // Counter for lines written unsigned int lines = 0; diff --git a/src/common/lookups/TalkgroupRulesLookup.cpp b/src/common/lookups/TalkgroupRulesLookup.cpp index 93240fb5..1d477648 100644 --- a/src/common/lookups/TalkgroupRulesLookup.cpp +++ b/src/common/lookups/TalkgroupRulesLookup.cpp @@ -358,10 +358,10 @@ bool TalkgroupRulesLookup::save() for (auto entry : m_groupVoice) { yaml::Node& gv = groupVoiceList.push_back(); entry.getYaml(gv); - //LogDebug(LOG_HOST, "Added TGID %s to yaml TG list", gv["name"].as().c_str()); + //LogDebugEx(LOG_HOST, "TalkgroupRulesLookup::save()", "Added TGID %s to yaml TG list", gv["name"].as().c_str()); } - //LogDebug(LOG_HOST, "Got final GroupVoiceList YAML size of %u", groupVoiceList.size()); + //LogDebugEx(LOG_HOST, "TalkgroupRulesLookup::save()", "Got final GroupVoiceList YAML size of %u", groupVoiceList.size()); // Set the new rules newRules["groupVoice"] = groupVoiceList; @@ -373,7 +373,7 @@ bool TalkgroupRulesLookup::save() } try { - //LogDebug(LOG_HOST, "Saving TGID file to %s", m_rulesFile.c_str()); + LogMessage(LOG_HOST, "Saving talkgroup rules file to %s", m_rulesFile.c_str()); yaml::Serialize(newRules, m_rulesFile.c_str()); LogDebug(LOG_HOST, "Saved TGID config file to %s", m_rulesFile.c_str()); } @@ -383,4 +383,4 @@ bool TalkgroupRulesLookup::save() } return true; -} \ No newline at end of file +} diff --git a/src/common/network/FrameQueue.cpp b/src/common/network/FrameQueue.cpp index 170f7434..2502a154 100644 --- a/src/common/network/FrameQueue.cpp +++ b/src/common/network/FrameQueue.cpp @@ -211,7 +211,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui if (timestamp != INVALID_TS) { timestamp += (RTP_GENERIC_CLOCK_RATE / 133); if (m_debug) - LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_streamTimestamps[streamId], timestamp, rtpSeq); + LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_streamTimestamps[streamId], timestamp, rtpSeq); m_streamTimestamps[streamId] = timestamp; } } @@ -232,7 +232,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) { if (m_debug) - LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); + LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); m_streamTimestamps[streamId] = header.getTimestamp(); } @@ -241,7 +241,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui auto entry = m_streamTimestamps.find(streamId); if (entry != m_streamTimestamps.end()) { if (m_debug) - LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); + LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); m_streamTimestamps.erase(streamId); } } diff --git a/src/common/network/rest/RequestDispatcher.h b/src/common/network/rest/RequestDispatcher.h index b2a87e95..a751100a 100644 --- a/src/common/network/rest/RequestDispatcher.h +++ b/src/common/network/rest/RequestDispatcher.h @@ -322,9 +322,9 @@ namespace network void handleRequest(const Request& request, Reply& reply) { for (auto header : request.headers.headers()) - ::LogDebug(LOG_REST, "DebugRequestDispatcher::handleRequest() header = %s, value = %s", header.name.c_str(), header.value.c_str()); + ::LogDebugEx(LOG_REST, "DebugRequestDispatcher::handleRequest()", "header = %s, value = %s", header.name.c_str(), header.value.c_str()); - ::LogDebug(LOG_REST, "DebugRequestDispatcher::handleRequest() content = %s", request.content.c_str()); + ::LogDebugEx(LOG_REST, "DebugRequestDispatcher::handleRequest()", "content = %s", request.content.c_str()); } }; diff --git a/src/common/network/rest/http/HTTPHeaders.h b/src/common/network/rest/http/HTTPHeaders.h index 74c24b81..94c5fef3 100644 --- a/src/common/network/rest/http/HTTPHeaders.h +++ b/src/common/network/rest/http/HTTPHeaders.h @@ -97,7 +97,7 @@ namespace network */ void add(const std::string& name, const std::string& value) { - //::LogDebug(LOG_REST, "HTTPHeaders::add(), header = %s, value = %s", name.c_str(), value.c_str()); + //::LogDebugEx(LOG_REST, "HTTPHeaders::add()", "header = %s, value = %s", name.c_str(), value.c_str()); for (auto& header : m_headers) { if (::strtolower(header.name) == ::strtolower(name)) { header.value = value; @@ -107,7 +107,7 @@ namespace network m_headers.push_back(Header(name, value)); //for (auto header : m_headers) - // ::LogDebug(LOG_REST, "HTTPHeaders::add() m_headers.header = %s, m_headers.value = %s", header.name.c_str(), header.value.c_str()); + // ::LogDebugEx(LOG_REST, "HTTPHeaders::add()", "m_headers.header = %s, m_headers.value = %s", header.name.c_str(), header.value.c_str()); } /** * @brief Helper to remove a HTTP header. diff --git a/src/common/network/rest/http/HTTPLexer.cpp b/src/common/network/rest/http/HTTPLexer.cpp index fcfe36f7..668d1820 100644 --- a/src/common/network/rest/http/HTTPLexer.cpp +++ b/src/common/network/rest/http/HTTPLexer.cpp @@ -358,7 +358,7 @@ HTTPLexer::ResultType HTTPLexer::consume(HTTPPayload& req, char input) case EXPECTING_NEWLINE_3: if (input == '\n') { for (auto header : m_headers) { - //::LogDebug(LOG_REST, "HTTPLexer::consume(), header = %s, value = %s", header.name.c_str(), header.value.c_str()); + //::LogDebugEx(LOG_REST, "HTTPLexer::consume()", "header = %s, value = %s", header.name.c_str(), header.value.c_str()); req.headers.add(header.name, header.value); } diff --git a/src/common/network/rest/http/HTTPPayload.cpp b/src/common/network/rest/http/HTTPPayload.cpp index 2fce5ed9..ca2fb0f0 100644 --- a/src/common/network/rest/http/HTTPPayload.cpp +++ b/src/common/network/rest/http/HTTPPayload.cpp @@ -279,7 +279,7 @@ std::vector HTTPPayload::toBuffers() // copy URI and erase zero terminator uri.erase(std::find(uri.begin(), uri.end(), '\0'), uri.end()); #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "HTTPPayload::toBuffers() method = %s, uri = %s", method.c_str(), uri.c_str()); + ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "method = %s, uri = %s", method.c_str(), uri.c_str()); #endif buffers.push_back(asio::buffer(method)); buffers.push_back(asio::buffer(misc_strings::request_method_separator)); @@ -295,7 +295,7 @@ std::vector HTTPPayload::toBuffers() for (std::size_t i = 0; i < headers.size(); ++i) { HTTPHeaders::Header& h = headers.m_headers[i]; #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "HTTPPayload::toBuffers() header = %s, value = %s", h.name.c_str(), h.value.c_str()); + ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "header = %s, value = %s", h.name.c_str(), h.value.c_str()); #endif buffers.push_back(asio::buffer(h.name)); @@ -309,9 +309,9 @@ std::vector HTTPPayload::toBuffers() buffers.push_back(asio::buffer(content)); #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "HTTPPayload::toBuffers() content = %s", content.c_str()); + ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "content = %s", content.c_str()); for (auto buffer : buffers) - Utils::dump("buffer[]", (uint8_t*)buffer.data(), buffer.size()); + Utils::dump("[HTTPPayload::toBuffers()] buffer[]", (uint8_t*)buffer.data(), buffer.size()); #endif return buffers; diff --git a/src/common/nxdn/channel/LICH.cpp b/src/common/nxdn/channel/LICH.cpp index fbb308ea..9798ae24 100644 --- a/src/common/nxdn/channel/LICH.cpp +++ b/src/common/nxdn/channel/LICH.cpp @@ -86,7 +86,7 @@ bool LICH::decode(const uint8_t* data) m_lich = lich[0U]; #if DEBUG_NXDN_LICH - LogDebug(LOG_NXDN, "LICH::decode(), m_lich = %02X", m_lich); + LogDebugEx(LOG_NXDN, "LICH::decode()", "m_lich = %02X", m_lich); #endif bool newParity = getParity(); @@ -121,7 +121,7 @@ void LICH::encode(uint8_t* data) m_lich |= (m_outbound ? 0x01U : 0x00U) << 1; #if DEBUG_NXDN_LICH - LogDebug(LOG_NXDN, "LICH::encode(), m_lich = %02X", m_lich); + LogDebugEx(LOG_NXDN, "LICH::encode()", "m_lich = %02X", m_lich); #endif bool parity = getParity(); diff --git a/src/common/p25/dfsi/LC.cpp b/src/common/p25/dfsi/LC.cpp index 4463546d..70d5b15e 100644 --- a/src/common/p25/dfsi/LC.cpp +++ b/src/common/p25/dfsi/LC.cpp @@ -405,8 +405,8 @@ void LC::encodeLDU1(uint8_t* data, const uint8_t* imbe) } #if DEBUG_P25_DFSI - LogDebug(LOG_P25, "LC::encodeLDU1(), frameType = $%02X", m_frameType); - Utils::dump(2U, "LC::encodeLDU1(), DFSI LDU1 Frame", dfsiFrame, frameLength); + LogDebugEx(LOG_P25, "LC::encodeLDU1()", "frameType = $%02X", m_frameType); + Utils::dump(2U, "[LC::encodeLDU1()] DFSI LDU1 Frame", dfsiFrame, frameLength); #endif ::memcpy(data, dfsiFrame, frameLength); @@ -646,8 +646,8 @@ void LC::encodeLDU2(uint8_t* data, const uint8_t* imbe) } #if DEBUG_P25_DFSI - LogDebug(LOG_P25, "LC::encodeLDU2(), frameType = $%02X", m_frameType); - Utils::dump(2U, "LC::encodeLDU2(), DFSI LDU2 Frame", dfsiFrame, frameLength); + LogDebugEx(LOG_P25, "LC::encodeLDU2()", "frameType = $%02X", m_frameType); + Utils::dump(2U, "[LC::encodeLDU2()] DFSI LDU2 Frame", dfsiFrame, frameLength); #endif ::memcpy(data, dfsiFrame, frameLength); diff --git a/src/common/p25/lc/AMBT.cpp b/src/common/p25/lc/AMBT.cpp index c9059404..36fb0f91 100644 --- a/src/common/p25/lc/AMBT.cpp +++ b/src/common/p25/lc/AMBT.cpp @@ -114,8 +114,8 @@ bool AMBT::decode(const data::DataHeader& dataHeader, const data::DataBlock* blo } if (m_verbose) { - LogDebug(LOG_P25, "AMBT::decode(), mfId = $%02X, lco = $%02X, ambt8 = $%02X, ambt9 = $%02X", m_mfId, m_lco, dataHeader.getAMBTField8(), dataHeader.getAMBTField9()); - Utils::dump(2U, "AMBT::decode(), pduUserData", pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()); + LogDebugEx(LOG_P25, "AMBT::decode()", "mfId = $%02X, lco = $%02X, ambt8 = $%02X, ambt9 = $%02X", m_mfId, m_lco, dataHeader.getAMBTField8(), dataHeader.getAMBTField9()); + Utils::dump(2U, "[AMBT::decode()] pduUserData", pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()); } return true; diff --git a/src/fne/HostFNE.cpp b/src/fne/HostFNE.cpp index 65fc2b9b..95789346 100644 --- a/src/fne/HostFNE.cpp +++ b/src/fne/HostFNE.cpp @@ -608,7 +608,7 @@ void* HostFNE::threadMasterNetwork(void* arg) HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -616,7 +616,7 @@ void* HostFNE::threadMasterNetwork(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -628,7 +628,7 @@ void* HostFNE::threadMasterNetwork(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -651,7 +651,7 @@ void* HostFNE::threadDiagNetwork(void* arg) HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -664,7 +664,7 @@ void* HostFNE::threadDiagNetwork(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -676,7 +676,7 @@ void* HostFNE::threadDiagNetwork(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -842,7 +842,7 @@ void* HostFNE::threadVirtualNetworking(void* arg) HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -855,7 +855,7 @@ void* HostFNE::threadVirtualNetworking(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -887,7 +887,7 @@ void* HostFNE::threadVirtualNetworking(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -906,7 +906,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg) HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -919,7 +919,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -947,7 +947,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/fne/network/RESTAPI.cpp b/src/fne/network/RESTAPI.cpp index 3b30f09d..9c13b47a 100644 --- a/src/fne/network/RESTAPI.cpp +++ b/src/fne/network/RESTAPI.cpp @@ -653,7 +653,7 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply) std::string host = request.headers.find("RemoteHost"); std::string headerToken = request.headers.find("X-DVM-Auth-Token"); #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() token, host = %s, token = %s", host.c_str(), headerToken.c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "token, host = %s, token = %s", host.c_str(), headerToken.c_str()); #endif if (headerToken.empty()) { errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED); @@ -662,11 +662,11 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply) for (auto& token : m_authTokens) { #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); #endif if (token.first.compare(host) == 0) { #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); #endif if (std::to_string(token.second).compare(headerToken) == 0) { return true; diff --git a/src/host/Host.DMR.cpp b/src/host/Host.DMR.cpp index f2106790..16c83e36 100644 --- a/src/host/Host.DMR.cpp +++ b/src/host/Host.DMR.cpp @@ -49,7 +49,7 @@ void* Host::threadDMRReader1(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -57,7 +57,7 @@ void* Host::threadDMRReader1(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -159,7 +159,7 @@ void* Host::threadDMRReader1(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -182,7 +182,7 @@ void* Host::threadDMRWriter1(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -190,7 +190,7 @@ void* Host::threadDMRWriter1(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -288,7 +288,7 @@ void* Host::threadDMRWriter1(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -311,7 +311,7 @@ void* Host::threadDMRReader2(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -319,7 +319,7 @@ void* Host::threadDMRReader2(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -420,7 +420,7 @@ void* Host::threadDMRReader2(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -443,7 +443,7 @@ void* Host::threadDMRWriter2(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -451,7 +451,7 @@ void* Host::threadDMRWriter2(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -549,7 +549,7 @@ void* Host::threadDMRWriter2(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/host/Host.NXDN.cpp b/src/host/Host.NXDN.cpp index 35d4bcec..b290a5e8 100644 --- a/src/host/Host.NXDN.cpp +++ b/src/host/Host.NXDN.cpp @@ -36,7 +36,7 @@ void* Host::threadNXDNReader(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -44,7 +44,7 @@ void* Host::threadNXDNReader(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -108,7 +108,7 @@ void* Host::threadNXDNReader(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -131,7 +131,7 @@ void* Host::threadNXDNWriter(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -139,7 +139,7 @@ void* Host::threadNXDNWriter(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -224,7 +224,7 @@ void* Host::threadNXDNWriter(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/host/Host.P25.cpp b/src/host/Host.P25.cpp index 5af51fb7..6311fc06 100644 --- a/src/host/Host.P25.cpp +++ b/src/host/Host.P25.cpp @@ -37,7 +37,7 @@ void* Host::threadP25Reader(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -45,7 +45,7 @@ void* Host::threadP25Reader(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -150,7 +150,7 @@ void* Host::threadP25Reader(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -173,7 +173,7 @@ void* Host::threadP25Writer(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -181,7 +181,7 @@ void* Host::threadP25Writer(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -309,7 +309,7 @@ void* Host::threadP25Writer(void* arg) } } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/host/Host.cpp b/src/host/Host.cpp index 639118bf..96750a5e 100644 --- a/src/host/Host.cpp +++ b/src/host/Host.cpp @@ -1697,7 +1697,7 @@ void* Host::threadModem(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -1705,7 +1705,7 @@ void* Host::threadModem(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -1734,7 +1734,7 @@ void* Host::threadModem(void* arg) Thread::sleep(m_idleTickDelay); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -1757,7 +1757,7 @@ void* Host::threadWatchdog(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -1765,7 +1765,7 @@ void* Host::threadWatchdog(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -1949,7 +1949,7 @@ void* Host::threadWatchdog(void* arg) Thread::sleep(m_idleTickDelay); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -1972,7 +1972,7 @@ void* Host::threadSiteData(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -1980,7 +1980,7 @@ void* Host::threadSiteData(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -2018,7 +2018,7 @@ void* Host::threadSiteData(void* arg) Thread::sleep(m_idleTickDelay); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } @@ -2041,7 +2041,7 @@ void* Host::threadPresence(void* arg) Host* host = static_cast(th->obj); if (host == nullptr) { g_killed = true; - LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); + LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); } if (g_killed) { @@ -2049,7 +2049,7 @@ void* Host::threadPresence(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -2125,7 +2125,7 @@ void* Host::threadPresence(void* arg) Thread::sleep(m_idleTickDelay); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/host/dmr/Slot.cpp b/src/host/dmr/Slot.cpp index a6727202..d27b83e5 100644 --- a/src/host/dmr/Slot.cpp +++ b/src/host/dmr/Slot.cpp @@ -1103,7 +1103,7 @@ void Slot::addFrame(const uint8_t *data, bool net, bool imm) fifoSpace = m_modem->getDMRSpace2(); } - //LogDebug(LOG_DMR, "Slot %u, addFrame() fifoSpace = %u", m_slotNo, fifoSpace); + //LogDebugEx(LOG_DMR, "Slot::addFrame()", "Slot %u, fifoSpace = %u", m_slotNo, fifoSpace); // is this immediate data? if (imm) { @@ -1506,7 +1506,7 @@ void Slot::writeRF_ControlData(uint16_t frameCnt, uint8_t n) bool grp = m_affiliations->isGroup(dstId); if (m_debug) { - LogDebug(LOG_DMR, "writeRF_ControlData, frameCnt = %u, seq = %u, late entry, dstId = %u, srcId = %u", frameCnt, n, dstId, srcId); + LogDebugEx(LOG_DMR, "Slot::writeRF_ControlData()", "frameCnt = %u, seq = %u, late entry, dstId = %u, srcId = %u", frameCnt, n, dstId, srcId); } m_control->writeRF_CSBK_Grant_LateEntry(dstId, srcId, grp); @@ -1709,8 +1709,8 @@ void Slot::setShortLC_TSCC(SiteData siteData, uint16_t counter) lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU); lc[4U] = edac::CRC::crc8(lc, 4U); - //LogDebug(LOG_DMR, "setShortLC_TSCC, netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); - //Utils::dump(1U, "shortLC_TSCC", lc, 5U); + //LogDebugEx(LOG_DMR, "Slot::setShortLC_TSCC()", "netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); + //Utils::dump(1U, "[Slot::shortLC_TSCC()]", lc, 5U); uint8_t sLC[9U]; @@ -1769,8 +1769,8 @@ void Slot::setShortLC_Payload(SiteData siteData, uint16_t counter) lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU); lc[4U] = edac::CRC::crc8(lc, 4U); - //LogDebug(LOG_DMR, "setShortLC_Payload, netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); - //Utils::dump(1U, "setShortLC_Payload", lc, 5U); + //LogDebugEx(LOG_DMR, "Slot::setShortLC_Payload()", "netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); + //Utils::dump(1U, "[Slot::setShortLC_Payload()]", lc, 5U); uint8_t sLC[9U]; diff --git a/src/host/dmr/lookups/DMRAffiliationLookup.cpp b/src/host/dmr/lookups/DMRAffiliationLookup.cpp index 37b1c540..8a486922 100644 --- a/src/host/dmr/lookups/DMRAffiliationLookup.cpp +++ b/src/host/dmr/lookups/DMRAffiliationLookup.cpp @@ -36,7 +36,7 @@ DMRAffiliationLookup::~DMRAffiliationLookup() = default; bool DMRAffiliationLookup::grantCh(uint32_t dstId, uint32_t srcId, uint32_t grantTimeout, bool grp, bool netGranted) { - ::LogDebug(LOG_HOST, "%s, DMRAffiliationLookup::grantCh() use grantChSlot() BUGBUG"); + ::LogDebugEx(LOG_HOST, "%s", "DMRAffiliationLookup::grantCh()", "use grantChSlot() BUGBUG"); return false; } diff --git a/src/host/modem/Modem.cpp b/src/host/modem/Modem.cpp index 53bbbd35..4e217546 100644 --- a/src/host/modem/Modem.cpp +++ b/src/host/modem/Modem.cpp @@ -581,7 +581,7 @@ void Modem::clock(uint32_t ms) m_rxDMRQueue1.addData(m_buffer + 3U, m_length - 3U); if (m_trace) - Utils::dump(1U, "Modem::clock() RX DMR Data 1", m_buffer + 3U, m_length - 3U); + Utils::dump(1U, "[Modem::clock()] RX DMR Data 1", m_buffer + 3U, m_length - 3U); } } break; @@ -607,7 +607,7 @@ void Modem::clock(uint32_t ms) m_rxDMRQueue2.addData(m_buffer + 3U, m_length - 3U); if (m_trace) - Utils::dump(1U, "Modem::clock() RX DMR Data 2", m_buffer + 3U, m_length - 3U); + Utils::dump(1U, "[Modem::clock()] RX DMR Data 2", m_buffer + 3U, m_length - 3U); } } break; @@ -669,7 +669,7 @@ void Modem::clock(uint32_t ms) m_rxP25Queue.addData(m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U)); if (m_trace) - Utils::dump(1U, "Modem::clock() RX P25 Data", m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U)); + Utils::dump(1U, "[Modem::clock()] RX P25 Data", m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U)); } } break; @@ -712,7 +712,7 @@ void Modem::clock(uint32_t ms) m_rxNXDNQueue.addData(m_buffer + 3U, m_length - 3U); if (m_trace) - Utils::dump(1U, "Modem::clock() RX NXDN Data", m_buffer + 3U, m_length - 3U); + Utils::dump(1U, "[Modem::clock()] RX NXDN Data", m_buffer + 3U, m_length - 3U); } } break; @@ -834,9 +834,9 @@ void Modem::clock(uint32_t ms) m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES); if (m_dumpModemStatus) { - LogDebug(LOG_MODEM, "Modem::clock(), CMD_GET_STATUS, isHotspot = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", + LogDebugEx(LOG_MODEM, "Modem::clock()", "CMD_GET_STATUS, isHotspot = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", m_isHotspot, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace); - LogDebug(LOG_MODEM, "Modem::clock(), CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", + LogDebugEx(LOG_MODEM, "Modem::clock()", "CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(), m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace()); } @@ -907,7 +907,7 @@ void Modem::clock(uint32_t ms) void Modem::close() { - LogDebug(LOG_MODEM, "Closing the modem"); + LogMessage(LOG_MODEM, "Closing the modem"); m_port->close(); m_gotModemStatus = false; @@ -928,7 +928,7 @@ uint32_t Modem::peekDMRFrame1Length() uint8_t len = 0U; m_rxDMRQueue1.peek(&len, 1U); #if DEBUG_MODEM - LogDebug(LOG_MODEM, "Modem::peekDMRFrame1Length() len = %u, dataSize = %u", len, m_rxDMRQueue1.dataSize()); + LogDebugEx(LOG_MODEM, "Modem::peekDMRFrame1Length()", "len = %u, dataSize = %u", len, m_rxDMRQueue1.dataSize()); #endif // this ensures we never get in a situation where we have length stuck on the queue if (m_rxDMRQueue1.dataSize() == 1U && len > m_rxDMRQueue1.dataSize()) { @@ -982,7 +982,7 @@ uint32_t Modem::peekDMRFrame2Length() uint8_t len = 0U; m_rxDMRQueue2.peek(&len, 1U); #if DEBUG_MODEM - LogDebug(LOG_MODEM, "Modem::peekDMRFrame2Length() len = %u, dataSize = %u", len, m_rxDMRQueue2.dataSize()); + LogDebugEx(LOG_MODEM, "Modem::peekDMRFrame2Length()", "len = %u, dataSize = %u", len, m_rxDMRQueue2.dataSize()); #endif // this ensures we never get in a situation where we have length stuck on the queue if (m_rxDMRQueue2.dataSize() == 1U && len > m_rxDMRQueue2.dataSize()) { @@ -1040,7 +1040,7 @@ uint32_t Modem::peekP25FrameLength() uint16_t len = 0U; len = (length[0U] << 8) + length[1U]; #if DEBUG_MODEM - LogDebug(LOG_MODEM, "Modem::peekP25FrameLength() len = %u, dataSize = %u", len, m_rxP25Queue.dataSize()); + LogDebugEx(LOG_MODEM, "Modem::peekP25FrameLength()", "len = %u, dataSize = %u", len, m_rxP25Queue.dataSize()); #endif // this ensures we never get in a situation where we have length stuck on the queue if (m_rxP25Queue.dataSize() == 2U && len > m_rxP25Queue.dataSize()) { @@ -1098,7 +1098,7 @@ uint32_t Modem::peekNXDNFrameLength() uint8_t len = 0U; m_rxNXDNQueue.peek(&len, 1U); #if DEBUG_MODEM - LogDebug(LOG_MODEM, "Modem::peekNXDNFrameLength() len = %u, dataSize = %u", len, m_rxNXDNQueue.dataSize()); + LogDebugEx(LOG_MODEM, "Modem::peekNXDNFrameLength()", "len = %u, dataSize = %u", len, m_rxNXDNQueue.dataSize()); #endif // this ensures we never get in a situation where we have length stuck on the queue if (m_rxNXDNQueue.dataSize() == 1U && len > m_rxNXDNQueue.dataSize()) { @@ -1222,7 +1222,7 @@ void Modem::clearDMRFrame1() buffer[1U] = 3U; buffer[2U] = CMD_DMR_CLEAR1; #if DEBUG_MODEM - Utils::dump(1U, "Modem::clearDMRFrame1(), Written", buffer, 3U); + Utils::dump(1U, "[Modem::clearDMRFrame1()] Written", buffer, 3U); #endif write(buffer, 3U); Thread::sleep(5); // 5ms delay @@ -1238,7 +1238,7 @@ void Modem::clearDMRFrame2() buffer[1U] = 3U; buffer[2U] = CMD_DMR_CLEAR2; #if DEBUG_MODEM - Utils::dump(1U, "Modem::clearDMRFrame2(), Written", buffer, 3U); + Utils::dump(1U, "[Modem::clearDMRFrame2()] Written", buffer, 3U); #endif write(buffer, 3U); Thread::sleep(5); // 5ms delay @@ -1254,7 +1254,7 @@ void Modem::clearP25Frame() buffer[1U] = 3U; buffer[2U] = CMD_P25_CLEAR; #if DEBUG_MODEM - Utils::dump(1U, "Modem::clearP25Data(), Written", buffer, 3U); + Utils::dump(1U, "[Modem::clearP25Data()] Written", buffer, 3U); #endif write(buffer, 3U); Thread::sleep(5); // 5ms delay @@ -1270,7 +1270,7 @@ void Modem::clearNXDNFrame() buffer[1U] = 3U; buffer[2U] = CMD_NXDN_CLEAR; #if DEBUG_MODEM - Utils::dump(1U, "Modem::clearNXDNFrame(), Written", buffer, 3U); + Utils::dump(1U, "[Modem::clearNXDNFrame()] Written", buffer, 3U); #endif write(buffer, 3U); Thread::sleep(5); // 5ms delay @@ -1382,7 +1382,7 @@ bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length) return false; if (length > MAX_LENGTH) { LogError(LOG_MODEM, "Modem::writeDMRData1(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeDMRData1(); Attmpted Data", data, length); + Utils::dump(1U, "[Modem::writeDMRData1()] Attmpted Data", data, length); return false; } @@ -1399,9 +1399,9 @@ bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length) // write or buffer DMR slot 1 data to air interface if (m_dmrSpace1 >= length) { if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeDMRData1(); immediate write (len %u)", length); + LogDebugEx(LOG_MODEM, "Modem::writeDMRData1()", "immediate write (len %u)", length); if (m_trace) - Utils::dump(1U, "Modem::writeDMRData1() Immediate TX DMR Data 1", buffer + 3U, length - 1U); + Utils::dump(1U, "[Modem::writeDMRData1()] Immediate TX DMR Data 1", buffer + 3U, length - 1U); int ret = write(buffer, len); if (ret != int(len)) { @@ -1453,9 +1453,9 @@ bool Modem::writeDMRFrame2(const uint8_t* data, uint32_t length) // write or buffer DMR slot 2 data to air interface if (m_dmrSpace2 >= length) { if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeDMRData2(); immediate write (len %u)", length); + LogDebugEx(LOG_MODEM, "Modem::writeDMRData2()", "immediate write (len %u)", length); if (m_trace) - Utils::dump(1U, "Modem::writeDMRData2() Immediate TX DMR Data 2", buffer + 3U, length - 1U); + Utils::dump(1U, "[Modem::writeDMRData2()] Immediate TX DMR Data 2", buffer + 3U, length - 1U); int ret = write(buffer, len); if (ret != int(len)) { @@ -1493,7 +1493,7 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length) return false; if (length > MAX_LENGTH) { LogError(LOG_MODEM, "Modem::writeP25Data(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeP25Data(); Attmpted Data", data, length); + Utils::dump(1U, "[Modem::writeP25Data()] Attmpted Data", data, length); return false; } @@ -1519,9 +1519,9 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length) // write or buffer P25 data to air interface if (m_p25Space >= length) { if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeP25Data(); immediate write (len %u)", length); + LogDebugEx(LOG_MODEM, "Modem::writeP25Data()", "immediate write (len %u)", length); if (m_trace) - Utils::dump(1U, "Modem::writeP25Data() Immediate TX P25 Data", buffer + 3U, length - 3U); + Utils::dump(1U, "[Modem::writeP25Data()] Immediate TX P25 Data", buffer + 3U, length - 3U); int ret = write(buffer, len); if (ret != int(len)) { @@ -1556,7 +1556,7 @@ bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length) return false; if (length > MAX_LENGTH) { LogError(LOG_MODEM, "Modem::writeNXDNData(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeNXDNData(); Attmpted Data", data, length); + Utils::dump(1U, "[Modem::writeNXDNData()] Attmpted Data", data, length); return false; } @@ -1573,9 +1573,9 @@ bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length) // write or buffer NXDN data to air interface if (m_nxdnSpace >= length) { if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeNXDNData(); immediate write (len %u)", length); + LogDebugEx(LOG_MODEM, "Modem::writeNXDNData()", "immediate write (len %u)", length); if (m_trace) - Utils::dump(1U, "Modem::writeNXDNData() Immediate TX NXDN Data", buffer + 3U, length - 1U); + Utils::dump(1U, "[Modem::writeNXDNData()] Immediate TX NXDN Data", buffer + 3U, length - 1U); int ret = write(buffer, len); if (ret != int(len)) { @@ -1613,7 +1613,7 @@ bool Modem::writeDMRStart(bool tx) buffer[2U] = CMD_DMR_START; buffer[3U] = tx ? 0x01U : 0x00U; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRStart(), Written", buffer, 4U); + Utils::dump(1U, "[Modem::writeDMRStart()] Written", buffer, 4U); #endif return write(buffer, 4U) == 4; } @@ -1644,7 +1644,7 @@ bool Modem::writeDMRShortLC(const uint8_t* lc) buffer[10U] = lc[7U]; buffer[11U] = lc[8U]; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRShortLC(), Written", buffer, 12U); + Utils::dump(1U, "[Modem::writeDMRShortLC()] Written", buffer, 12U); #endif return write(buffer, 12U) == 12; } @@ -1665,7 +1665,7 @@ bool Modem::writeDMRAbort(uint32_t slotNo) buffer[2U] = CMD_DMR_ABORT; buffer[3U] = slotNo; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRAbort(), Written", buffer, 4U); + Utils::dump(1U, "[Modem::writeDMRAbort()] Written", buffer, 4U); #endif return write(buffer, 4U) == 4; } @@ -1689,7 +1689,7 @@ bool Modem::setDMRIgnoreCACH_AT(uint8_t slotNo) // are we on a protocol version 3 firmware? if (m_protoVer >= 3U) { #if DEBUG_MODEM - Utils::dump(1U, "Modem::setDMRIgnoreCACH_AT(), Written", buffer, 4U); + Utils::dump(1U, "[Modem::setDMRIgnoreCACH_AT()] Written", buffer, 4U); #endif return write(buffer, 4U) == 4; } else { @@ -1734,7 +1734,7 @@ bool Modem::setState(DVM_STATE state) buffer[2U] = CMD_SET_MODE; buffer[3U] = state; #if DEBUG_MODEM - Utils::dump(1U, "Modem::setState(), Written", buffer, 4U); + Utils::dump(1U, "[Modem::setState()] Written", buffer, 4U); #endif return write(buffer, 4U) == 4; } @@ -1876,7 +1876,7 @@ bool Modem::getStatus() buffer[1U] = 3U; buffer[2U] = CMD_GET_STATUS; - //LogDebug(LOG_MODEM, "getStatus(), polling modem status"); + //LogDebugEx(LOG_MODEM, "Modem::getStatus()", "polling modem status"); return write(buffer, 3U) == 3; } @@ -2372,7 +2372,7 @@ RESP_TYPE_DVM Modem::getResponse() { m_rspDoubleLength = false; - //LogDebug(LOG_MODEM, "Modem::getResponse(), checking if we have data"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "checking if we have data"); // get the start of the frame or nothing at all if (m_rspState == RESP_START) { @@ -2384,13 +2384,13 @@ RESP_TYPE_DVM Modem::getResponse() } if (ret == 0) { - //LogDebug(LOG_MODEM, "Modem::getResponse(), no data available"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "no data available"); return RTM_TIMEOUT; } if (m_buffer[0U] != DVM_SHORT_FRAME_START && m_buffer[0U] != DVM_LONG_FRAME_START) { - //LogError(LOG_MODEM, "Modem::getResponse(), illegal response, first byte not a frame start; byte = %02X", m_buffer[0U]); + //LogErrorEx(LOG_MODEM, "Modem::getResponse()", "illegal response, first byte not a frame start; byte = %02X", m_buffer[0U]); ::memset(m_buffer, 0x00U, BUFFER_LENGTH); m_rspState = RESP_START; return RTM_ERROR; @@ -2400,12 +2400,12 @@ RESP_TYPE_DVM Modem::getResponse() m_rspDoubleLength = true; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_START"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_START"); m_rspState = RESP_LENGTH1; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame length 1/2, rspDoubleLength = %u", m_rspDoubleLength); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame length 1/2, rspDoubleLength = %u", m_rspDoubleLength); // get the length of the frame, 1/2 if (m_rspState == RESP_LENGTH1) { int ret = m_port->read(m_buffer + 1U, 1U); @@ -2432,12 +2432,12 @@ RESP_TYPE_DVM Modem::getResponse() m_length = m_buffer[1U]; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_LENGTH1, len = %u", m_length); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_LENGTH1, len = %u", m_length); m_rspOffset = 2U; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame length 2/2"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame length 2/2"); // get the length of the frame, 2/2 if (m_rspState == RESP_LENGTH2) { int ret = m_port->read(m_buffer + 2U, 1U); @@ -2453,13 +2453,13 @@ RESP_TYPE_DVM Modem::getResponse() m_length = (m_length + (m_buffer[2U] & 0xFFU)); m_rspState = RESP_TYPE; - //LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_LENGTH2, len = %u", m_length); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_LENGTH2, len = %u", m_length); m_rspDoubleLength = true; m_rspOffset = 3U; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame type"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame type"); // get the frame type if (m_rspState == RESP_TYPE) { int ret = m_port->read(m_buffer + m_rspOffset, 1U); @@ -2474,18 +2474,18 @@ RESP_TYPE_DVM Modem::getResponse() m_rspType = (DVM_COMMANDS)m_buffer[m_rspOffset]; - //LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_TYPE, len = %u, type = %u", m_length, m_rspType); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_TYPE, len = %u, type = %u", m_length, m_rspType); m_rspState = RESP_DATA; m_rspOffset++; } - //LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame data"); + //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame data"); // get the frame data if (m_rspState == RESP_DATA) { if (m_respTrace) - LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_DATA, len = %u, offset = %u, type = %02X", m_length, m_rspOffset, m_rspType); + LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_DATA, len = %u, offset = %u, type = %02X", m_length, m_rspOffset, m_rspType); while (m_rspOffset < m_length) { int ret = m_port->read(m_buffer + m_rspOffset, m_length - m_rspOffset); @@ -2503,7 +2503,7 @@ RESP_TYPE_DVM Modem::getResponse() } if (m_respTrace) - Utils::dump(1U, "Modem::getResponse() Buffer", m_buffer, m_length); + Utils::dump(1U, "[Modem::getResponse()] Buffer", m_buffer, m_length); } m_rspState = RESP_START; diff --git a/src/host/modem/ModemV24.cpp b/src/host/modem/ModemV24.cpp index 6a355ac8..c2e41e89 100644 --- a/src/host/modem/ModemV24.cpp +++ b/src/host/modem/ModemV24.cpp @@ -320,9 +320,9 @@ void ModemV24::clock(uint32_t ms) m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES); if (m_dumpModemStatus) { - LogDebug(LOG_MODEM, "ModemV24::clock(), CMD_GET_STATUS, isHotspot = %u, v24Connected = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", + LogDebugEx(LOG_MODEM, "ModemV24::clock()", "CMD_GET_STATUS, isHotspot = %u, v24Connected = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", m_isHotspot, m_v24Connected, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace); - LogDebug(LOG_MODEM, "ModemV24::clock(), CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", + LogDebugEx(LOG_MODEM, "ModemV24::clock()", "CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(), m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace()); } @@ -409,7 +409,7 @@ void ModemV24::clock(uint32_t ms) void ModemV24::close() { - LogDebug(LOG_MODEM, "Closing the modem"); + LogMessage(LOG_MODEM, "Closing the modem"); m_port->close(); m_gotModemStatus = false; @@ -1553,9 +1553,9 @@ void ModemV24::queueP25Frame(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msgType assert(len > 0U); if (m_debug) - LogDebug(LOG_MODEM, "ModemV24::queueP25Frame() msgType = $%02X", msgType); + LogDebugEx(LOG_MODEM, "ModemV24::queueP25Frame()", "msgType = $%02X", msgType); if (m_trace) - Utils::dump(1U, "ModemV24::queueP25Frame() data", data, len); + Utils::dump(1U, "[ModemV24::queueP25Frame()] data", data, len); // get current time in ms uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); diff --git a/src/host/modem/port/specialized/V24UDPPort.cpp b/src/host/modem/port/specialized/V24UDPPort.cpp index c4776305..e48711da 100644 --- a/src/host/modem/port/specialized/V24UDPPort.cpp +++ b/src/host/modem/port/specialized/V24UDPPort.cpp @@ -759,7 +759,7 @@ uint8_t* V24UDPPort::generateMessage(const uint8_t* message, uint32_t length, ui if (timestamp != INVALID_TS) { timestamp += (RTP_GENERIC_CLOCK_RATE / 133); if (m_debug) - LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_timestamp, timestamp, rtpSeq); + LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_timestamp, timestamp, rtpSeq); m_timestamp = timestamp; } @@ -779,20 +779,20 @@ uint8_t* V24UDPPort::generateMessage(const uint8_t* message, uint32_t length, ui if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) { if (m_debug) - LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); + LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); m_timestamp = header.getTimestamp(); } if (streamId != 0U && rtpSeq == RTP_END_OF_CALL_SEQ) { m_timestamp = INVALID_TS; if (m_debug) - LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); + LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); } ::memcpy(buffer + RTP_HEADER_LENGTH_BYTES, message, length); if (m_debug) - Utils::dump(1U, "V24UDPPort::generateMessage() Buffered Message", buffer, bufferLen); + Utils::dump(1U, "[V24UDPPort::generateMessage()] Buffered Message", buffer, bufferLen); if (outBufferLen != nullptr) { *outBufferLen = bufferLen; diff --git a/src/host/network/Network.cpp b/src/host/network/Network.cpp index 2f84900b..b3b54526 100644 --- a/src/host/network/Network.cpp +++ b/src/host/network/Network.cpp @@ -226,7 +226,7 @@ void Network::clock(uint32_t ms) } if (m_debug) { - LogDebug(LOG_NET, "RTP, peerId = %u, seq = %u, streamId = %u, func = %02X, subFunc = %02X", fneHeader.getPeerId(), rtpHeader.getSequence(), + LogDebugEx(LOG_NET, "Network::clock()", "RTP, peerId = %u, seq = %u, streamId = %u, func = %02X, subFunc = %02X", fneHeader.getPeerId(), rtpHeader.getSequence(), fneHeader.getStreamId(), fneHeader.getFunction(), fneHeader.getSubFunction()); } @@ -280,7 +280,7 @@ void Network::clock(uint32_t ms) } if (m_debug) - Utils::dump(1U, "Network Received, DMR", buffer.get(), length); + Utils::dump(1U, "[Network::clock()] Network Received, DMR", buffer.get(), length); if (length > 255) LogError(LOG_NET, "DMR Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); @@ -308,7 +308,7 @@ void Network::clock(uint32_t ms) } if (m_debug) - Utils::dump(1U, "Network Received, P25", buffer.get(), length); + Utils::dump(1U, "[Network::clock()] Network Received, P25", buffer.get(), length); if (length > 255) LogError(LOG_NET, "P25 Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); @@ -336,7 +336,7 @@ void Network::clock(uint32_t ms) } if (m_debug) - Utils::dump(1U, "Network Received, NXDN", buffer.get(), length); + Utils::dump(1U, "[Network::clock()] Network Received, NXDN", buffer.get(), length); if (length > 255) LogError(LOG_NET, "NXDN Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); @@ -548,7 +548,7 @@ void Network::clock(uint32_t ms) { switch (m_status) { case NET_STAT_WAITING_LOGIN: - LogDebug(LOG_NET, "PEER %u RPTL ACK, performing login exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); + LogMessage(LOG_NET, "PEER %u RPTL ACK, performing login exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); ::memcpy(m_salt, buffer.get() + 6U, sizeof(uint32_t)); writeAuthorisation(); @@ -558,7 +558,7 @@ void Network::clock(uint32_t ms) m_retryTimer.start(); break; case NET_STAT_WAITING_AUTHORISATION: - LogDebug(LOG_NET, "PEER %u RPTK ACK, performing configuration exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); + LogMessage(LOG_NET, "PEER %u RPTK ACK, performing configuration exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); writeConfig(); diff --git a/src/host/network/RESTAPI.cpp b/src/host/network/RESTAPI.cpp index 67e03f7c..828477dd 100644 --- a/src/host/network/RESTAPI.cpp +++ b/src/host/network/RESTAPI.cpp @@ -349,7 +349,7 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply) std::string host = request.headers.find("RemoteHost"); std::string headerToken = request.headers.find("X-DVM-Auth-Token"); #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() token, host = %s, token = %s", host.c_str(), headerToken.c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "token, host = %s, token = %s", host.c_str(), headerToken.c_str()); #endif if (headerToken.empty()) { errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED); @@ -358,11 +358,11 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply) for (auto& token : m_authTokens) { #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); #endif if (token.first.compare(host) == 0) { #if DEBUG_HTTP_PAYLOAD - ::LogDebug(LOG_REST, "RESTAPI::validateAuth() storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); + ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); #endif if (std::to_string(token.second).compare(headerToken) == 0) { return true; @@ -1006,7 +1006,7 @@ void RESTAPI::restAPI_PutRegisterCCVC(const HTTPPayload& request, HTTPPayload& r uint32_t peerId = req["peerId"].get(); - // LogDebug(LOG_REST, "restAPI_PutRegisterCCVC(): callback, channelNo = %u, peerId = %u", channelNo, peerId); + // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutRegisterCCVC()", "callback, channelNo = %u, peerId = %u", channelNo, peerId); // validate restAddress is a string within the JSON blob if (!req["restAddress"].is()) { @@ -1087,7 +1087,7 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r return; } - // LogDebug(LOG_REST, "restAPI_PutReleaseGrant(): callback, state = %u, dstId = %u", state, dstId); + // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutReleaseGrant()", "callback, state = %u, dstId = %u", state, dstId); switch (state) { case STATE_DMR: @@ -1179,7 +1179,7 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep return; } - // LogDebug(LOG_REST, "restAPI_PutTouchGrant(): callback, state = %u, dstId = %u", state, dstId); + // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutTouchGrant()", "callback, state = %u, dstId = %u", state, dstId); switch (state) { case STATE_DMR: diff --git a/src/host/nxdn/Control.cpp b/src/host/nxdn/Control.cpp index bd1ccbbe..311a9e58 100644 --- a/src/host/nxdn/Control.cpp +++ b/src/host/nxdn/Control.cpp @@ -877,7 +877,7 @@ void Control::addFrame(const uint8_t *data, bool net, bool imm) uint32_t fifoSpace = m_modem->getNXDNSpace(); - //LogDebug(LOG_NXDN, "addFrame() fifoSpace = %u", fifoSpace); + //LogDebugEx(LOG_NXDN, "Control::addFrame()", "fifoSpace = %u", fifoSpace); // is this immediate data? if (imm) { diff --git a/src/host/nxdn/packet/ControlSignaling.cpp b/src/host/nxdn/packet/ControlSignaling.cpp index 80fc82bf..28babb81 100644 --- a/src/host/nxdn/packet/ControlSignaling.cpp +++ b/src/host/nxdn/packet/ControlSignaling.cpp @@ -398,7 +398,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj do { if (m_debug) { - LogDebug(LOG_NXDN, "writeRF_ControlData, frameCnt = %u, seq = %u", frameCnt, n); + LogDebugEx(LOG_NXDN, "ControlSignaling::writeRF_ControlData()", "frameCnt = %u, seq = %u", frameCnt, n); } switch (n) diff --git a/src/host/p25/Control.cpp b/src/host/p25/Control.cpp index f4f6a5c1..1c125252 100644 --- a/src/host/p25/Control.cpp +++ b/src/host/p25/Control.cpp @@ -1194,7 +1194,7 @@ void Control::addFrame(const uint8_t* data, uint32_t length, bool net, bool imm) uint32_t fifoSpace = m_modem->getP25Space(); - //LogDebug(LOG_P25, "addFrame() fifoSpace = %u", fifoSpace); + // LogDebugEx(LOG_P25, "Control::addFrame()", "fifoSpace = %u", fifoSpace); // is this immediate data? if (imm) { @@ -1689,10 +1689,6 @@ void Control::writeRF_Nulls() data[0U] = modem::TAG_EOT; data[1U] = 0x00U; - if (m_debug) { - LogDebug(LOG_P25, "writeRF_Nulls()"); - } - addFrame(data, NULLS_LENGTH_BYTES + 2U); } diff --git a/src/host/p25/packet/ControlSignaling.cpp b/src/host/p25/packet/ControlSignaling.cpp index 1e9f36f2..b9d1c4b4 100644 --- a/src/host/p25/packet/ControlSignaling.cpp +++ b/src/host/p25/packet/ControlSignaling.cpp @@ -1784,7 +1784,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj } if (m_debug) { - LogDebug(LOG_P25, "writeRF_ControlData, mbfCnt = %u, frameCnt = %u, seq = %u, adjSS = %u", m_mbfCnt, frameCnt, n, adjSS); + LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()", "mbfCnt = %u, frameCnt = %u, seq = %u, adjSS = %u", m_mbfCnt, frameCnt, n, adjSS); } // bryanb: this is just a simple counter because we treat the SYNC_BCST as unlocked @@ -1877,7 +1877,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj queueRF_TSBK_Ctrl(TSBKO::OSP_RFSS_STS_BCAST); queueRF_TSBK_Ctrl(TSBKO::OSP_NET_STS_BCAST); if (m_debug) { - LogDebug(LOG_P25, "writeRF_ControlData, have 1 pad 2, mbfCnt = %u", m_mbfCnt); + LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()]", "have 1 pad 2, mbfCnt = %u", m_mbfCnt); } } @@ -1892,7 +1892,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj } if (m_debug) { - LogDebug(LOG_P25, "writeRF_ControlData, have 2 pad 1, mbfCnt = %u", m_mbfCnt); + LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()", "have 2 pad 1, mbfCnt = %u", m_mbfCnt); } } diff --git a/src/sysview/HostWS.cpp b/src/sysview/HostWS.cpp index fe60e38e..d8ea7591 100644 --- a/src/sysview/HostWS.cpp +++ b/src/sysview/HostWS.cpp @@ -533,7 +533,7 @@ void* HostWS::threadWebSocket(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -542,7 +542,7 @@ void* HostWS::threadWebSocket(void* arg) ws->m_wsServer.start_accept(); ws->m_wsServer.run(); - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/sysview/NodeStatusWnd.h b/src/sysview/NodeStatusWnd.h index 8bf42a87..01572da8 100644 --- a/src/sysview/NodeStatusWnd.h +++ b/src/sysview/NodeStatusWnd.h @@ -887,7 +887,7 @@ private: return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -909,7 +909,7 @@ private: } wnd->m_threadStopped = true; - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; } diff --git a/src/sysview/SysViewMain.cpp b/src/sysview/SysViewMain.cpp index 5ed79fd0..cf099344 100644 --- a/src/sysview/SysViewMain.cpp +++ b/src/sysview/SysViewMain.cpp @@ -286,7 +286,7 @@ void* threadNetworkPump(void* arg) return nullptr; } - LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE @@ -985,7 +985,7 @@ void* threadNetworkPump(void* arg) Thread::sleep(1U); } - LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); + LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str()); delete th; }