Added basic Logger with 4 modes.

This commit is contained in:
2025-01-26 18:02:39 +02:00
parent 7dd6f81264
commit 516eeab751
8 changed files with 126 additions and 107 deletions

View File

@@ -14,7 +14,9 @@ TODO List:
- Add
*/
#include "logging.hpp"
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncMqttClient.h>
#include <ArduinoJson.h>
@@ -67,10 +69,10 @@ void setup()
}
// Initialize SPIFFS
if (!SPIFFS.begin(true)) { // 'true' means format SPIFFS if initialization fails
Serial.println("Failed to mount SPIFFS");
LOG_ERROR("Failed to mount SPIFFS");
while(true) delay(10);
}
Serial.println("SPIFFS mounted successfully");
LOG_INFO("SPIFFS mounted successfully");
delay(50);
// Initialize RTC
if (!rtc.begin()) {
@@ -79,7 +81,7 @@ void setup()
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running, let's set the time!");
LOG_INFO("RTC is NOT running, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
@@ -104,7 +106,7 @@ void setup()
if (schedulerTimer != NULL) {
xTimerStart(schedulerTimer, 0);
} else {
Serial.println("Failed to create timer!");
LOG_ERROR("Failed to create timer!");
}
timekeeper.refreshDailySchedule();