Files
spore/examples/logging_example/main.cpp

41 lines
1.1 KiB
C++

#include "spore/Spore.h"
#include "spore/util/Logging.h"
#include <Arduino.h>
Spore spore;
void setup() {
// Initialize Spore framework
spore.setup();
// Start the framework
spore.begin();
// Demonstrate different logging levels
LOG_INFO("Example", "Logging example started");
LOG_DEBUG("Example", "This is a debug message");
LOG_WARN("Example", "This is a warning message");
LOG_ERROR("Example", "This is an error message");
// Demonstrate logging with different components
LOG_INFO("Network", "WiFi connection established");
LOG_INFO("Cluster", "Node discovered: esp-123456");
LOG_INFO("API", "Server started on port 80");
LOG_INFO("Example", "All logging now uses the simplified system!");
}
void loop() {
// Run the Spore framework
spore.loop();
// Log some periodic information
static unsigned long lastLog = 0;
if (millis() - lastLog > 5000) {
LOG_DEBUG("Example", "System running - Free heap: " + String(ESP.getFreeHeap()));
lastLog = millis();
}
delay(100);
}