Configurable HASP_LOG_LEVEL

This commit is contained in:
fvanroie 2022-02-18 10:43:04 +01:00
parent 3311de016c
commit ee568a791a
5 changed files with 11 additions and 5 deletions

View File

@ -4,10 +4,16 @@
#ifndef HASP_MACRO_H
#define HASP_MACRO_H
#ifdef USE_CONFIG_OVERRIDE
#include "user_config_override.h"
#endif
#if defined(WINDOWS) || defined(POSIX)
#define LOG_OUTPUT(x, ...) printf(__VA_ARGS__)
#else
#include "ArduinoLog.h"
#ifndef HASP_LOG_LEVEL
#define HASP_LOG_LEVEL LOG_LEVEL_TRACE
#endif

View File

@ -73,7 +73,7 @@ void task_every_second_cb(lv_task_t* task)
case 5:
#ifdef HASP_USE_STAT_COUNTER
if(statLoopCounter)
LOG_VERBOSE(TAG_MAIN, F("%d millis per loop, %d counted"), 5000 / statLoopCounter, statLoopCounter);
LOG_DEBUG(TAG_MAIN, F("%d millis per loop, %d counted"), 5000 / statLoopCounter, statLoopCounter);
statLoopCounter = 0;
#endif
break;

View File

@ -114,7 +114,7 @@ void debugStartSyslog()
if(syslogClient) {
if(syslogClient->beginPacket(debugSyslogHost, debugSyslogPort)) {
Log.registerOutput(2, syslogClient, LOG_LEVEL_VERBOSE, true);
Log.registerOutput(2, syslogClient, HASP_LOG_LEVEL, true);
LOG_INFO(TAG_SYSL, F(D_SERVICE_STARTED));
}
} else {
@ -364,7 +364,7 @@ void debugStartSerial()
Serial.begin(baudrate); /* prepare for possible serial debug */
delay(10);
Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true); // LOG_LEVEL_VERBOSE
Log.registerOutput(0, &Serial, HASP_LOG_LEVEL, true); // LOG_LEVEL_VERBOSE
// debugSerialStarted = true;

View File

@ -210,7 +210,7 @@ IRAM_ATTR void loop()
mainLoopCounter = 0;
#ifdef HASP_USE_STAT_COUNTER
if(statLoopCounter)
LOG_VERBOSE(TAG_MAIN, F("%d millis per loop, %d counted"), 5000 / statLoopCounter, statLoopCounter);
LOG_DEBUG(TAG_MAIN, F("%d millis per loop, %d counted"), 5000 / statLoopCounter, statLoopCounter);
statLoopCounter = 0;
#endif
break;

View File

@ -111,7 +111,7 @@ void consoleStart()
debugStartSerial(); // open Serial port
/* Now register logger for serial */
Log.registerOutput(0, bufferedSerialClient, LOG_LEVEL_VERBOSE, true);
Log.registerOutput(0, bufferedSerialClient, HASP_LOG_LEVEL, true);
bufferedSerialClient->flush();
LOG_INFO(TAG_CONS, F(D_SERVICE_STARTED));