diff --git a/src/Config.cpp b/src/Config.cpp index a7e0032..933f326 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -65,7 +65,7 @@ namespace config { void reset() { #define CURRENT_LOGGER_FUNCTION "reset" - VERBOSE; + NOTICE; config_t config = {}; config.seed = CONFIG_SEED; diff --git a/src/Hardware.cpp b/src/Hardware.cpp index 0c8355c..3cd7c59 100644 --- a/src/Hardware.cpp +++ b/src/Hardware.cpp @@ -46,7 +46,7 @@ namespace hardware { void setup() { #define CURRENT_LOGGER_FUNCTION "setup" - NOTICE; + VERBOSE; simSerial.begin(SIM808_BAUDRATE); device.begin(simSerial); diff --git a/src/Logging.h b/src/Logging.h index 6cef01a..dd855e3 100644 --- a/src/Logging.h +++ b/src/Logging.h @@ -17,8 +17,8 @@ #define NL "\n" #define LOG(level) LOG_MSG(level, "") -#define LOG_MSG(level, msg) Log.level(F("[" CURRENT_LOGGER "::" CURRENT_LOGGER_FUNCTION "]" msg NL)) -#define LOG_FORMAT(level, msg, ...) Log.level(F("[" CURRENT_LOGGER "::" CURRENT_LOGGER_FUNCTION "]" msg NL), __VA_ARGS__) +#define LOG_MSG(level, msg) Log.level(F("[" CURRENT_LOGGER "::" CURRENT_LOGGER_FUNCTION "] " msg NL)) +#define LOG_FORMAT(level, msg, ...) Log.level(F("[" CURRENT_LOGGER "::" CURRENT_LOGGER_FUNCTION "] " msg NL), __VA_ARGS__) #if defined(LOG_LEVEL_VERBOSE_ENABLED) #define VERBOSE LOG(verbose) diff --git a/src/Network.cpp b/src/Network.cpp index 86a0ecc..efaafc1 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -9,6 +9,14 @@ namespace network { #define CURRENT_LOGGER "network" timestamp_t _poweredOnTime; + namespace details { + + void print(SIM808_NETWORK_REGISTRATION_STATE state, SIM808SignalQualityReport &report) { + #define CURRENT_LOGGER_FUNCTION "print" + NOTICE_FORMAT("%d, [%d %ddBm]", state, report.rssi, report.attenuation); + } + + } void powerOn() { hardware::sim808::networkPowerOn(); _poweredOnTime = rtc::getTime(); @@ -22,6 +30,7 @@ namespace network { __attribute__((__optimize__("O2"))) SIM808_NETWORK_REGISTRATION_STATE waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true) { #define CURRENT_LOGGER_FUNCTION "waitForRegistered" + NOTICE; SIM808_NETWORK_REGISTRATION_STATE currentStatus; SIM808SignalQualityReport report; @@ -34,8 +43,7 @@ namespace network { do { if (isAvailable(currentStatus)) break; - - NOTICE_FORMAT("%d, [%d %ddBm]", currentStatus, report.rssi, report.attenuation); + details::print(currentStatus, report); if (report.rssi < NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD) noReliableNetwork++; else noReliableNetwork = 0; @@ -51,7 +59,7 @@ namespace network { report = hardware::sim808::device.getSignalQuality(); } while (timeout > 1); - NOTICE_FORMAT("%d, [%d %ddBm]", currentStatus, report.rssi, report.attenuation); + details::print(currentStatus, report); return currentStatus; } diff --git a/src/NetworkPositionsBackup.cpp b/src/NetworkPositionsBackup.cpp index b13f8b2..f0298f4 100644 --- a/src/NetworkPositionsBackup.cpp +++ b/src/NetworkPositionsBackup.cpp @@ -102,7 +102,7 @@ namespace positions { void NetworkPositionsBackup::prepare() { #define CURRENT_LOGGER_FUNCTION "prepare" - NOTICE; + VERBOSE; if (!isBackupNeeded(true)) return; network::powerOn();