diff --git a/data_source/settings.htm b/data_source/settings.htm index 4f16a7c..2ce48d9 100644 --- a/data_source/settings.htm +++ b/data_source/settings.htm @@ -2401,7 +2401,7 @@

Calibrate Flowmeters

- @@ -2697,7 +2697,7 @@

Debug Configuration

- diff --git a/data_source/version.json b/data_source/version.json index 0280c95..af740ed 100644 --- a/data_source/version.json +++ b/data_source/version.json @@ -1,4 +1,4 @@ { - "fw_version": "1.3.0", - "fs_version": "1.3.0" + "fw_version": "1.3.1-Beta.1", + "fs_version": "1.3.1-Beta.1" } diff --git a/platformio.ini b/platformio.ini index fbff086..6473320 100644 --- a/platformio.ini +++ b/platformio.ini @@ -44,7 +44,7 @@ lib_deps = lbussy/LCBUrl @ ~1.1.9 bblanchon/ArduinoJson @ ~6.21.2 https://github.com/lbussy/DS18B20_RT @ ~0.1.4 - https://github.com/lbussy/Arduino-Log @ ~1.0.3 + https://github.com/lbussy/Arduino-Log @ 1.1.1+sha.31d7620 https://github.com/lbussy/AsyncWiFiManager.git https://github.com/lbussy/AsyncTCP#smarthomerocks https://github.com/lbussy/ESPAsyncWebServer @ ~1.2.3 diff --git a/src/serialhandler.cpp b/src/serialhandler.cpp index adbe129..c095e03 100644 --- a/src/serialhandler.cpp +++ b/src/serialhandler.cpp @@ -62,13 +62,13 @@ void serialBegin() { SERIAL.setDebugOutput(false); Log.begin(LOG_LEVEL_SILENT, &SERIAL, true); - Log.setPrefix(printTimestamp); + Log.setPrefix(printPrefix); } else if (!app.copconfig.serial) { SERIAL.setDebugOutput(true); Log.begin(app.copconfig.loglevel, &SERIAL, true); - Log.setPrefix(printTimestamp); + Log.setPrefix(printPrefix); Log.notice(F("Serial logging started at %l." CR), BAUD); } #endif @@ -88,13 +88,13 @@ void serialStop() { Serial.setDebugOutput(false); Log.begin(LOG_LEVEL_SILENT, &SERIAL, true); - Log.setPrefix(printTimestamp); + Log.setPrefix(printPrefix); } else if (!app.copconfig.serial) { Serial.setDebugOutput(true); Log.begin(LOG_LEVEL, &SERIAL, true); - Log.setPrefix(printTimestamp); + Log.setPrefix(printPrefix); Log.notice(F("Local serial logging started at %l." CR), BAUD); } #endif @@ -107,6 +107,11 @@ void serialRestart() serialBegin(); } +void printPrefix(Print* _logOutput, int logLevel) { + printTimestamp(_logOutput); + printLogLevel (_logOutput, logLevel); +} + void printTimestamp(Print *_logOutput) { time_t now; @@ -118,6 +123,21 @@ void printTimestamp(Print *_logOutput) _logOutput->print(locTime); } +void printLogLevel(Print* _logOutput, int logLevel) { + /// Show log description based on log level + switch (logLevel) + { + default: + case 0:_logOutput->print("SILENT " ); break; + case 1:_logOutput->print("FATAL " ); break; + case 2:_logOutput->print("ERROR " ); break; + case 3:_logOutput->print("WARNING "); break; + case 4:_logOutput->print("INFO " ); break; + case 5:_logOutput->print("TRACE " ); break; + case 6:_logOutput->print("VERBOSE "); break; + } +} + size_t printDot() { return SERIAL.print(F(".")); @@ -524,7 +544,7 @@ void toggleSerialCompat(bool enable) SERIAL.flush(); SERIAL.setDebugOutput(true); Log.begin(LOG_LEVEL, &SERIAL, true); - Log.setPrefix(printTimestamp); + Log.setPrefix(printPrefix); Log.notice(F("Serial communications (terse mode) disabled, debug print enabled." CR)); } else diff --git a/src/serialhandler.h b/src/serialhandler.h index e3c3be2..5b92093 100644 --- a/src/serialhandler.h +++ b/src/serialhandler.h @@ -34,7 +34,9 @@ void serialBegin(); void serialStop(); void serialRestart(); void toggleSerialCompat(bool); +void printPrefix(Print* _logOutput, int logLevel); void printTimestamp(Print *_logOutput); +void printLogLevel(Print* _logOutput, int logLevel); void serialLoop(); // Telnet Handlers