feat: releay ui example, simplify logging
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "spore/Spore.h"
|
||||
#include "spore/services/LoggingService.h"
|
||||
#include "spore/util/Logging.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
Spore spore;
|
||||
@@ -12,22 +12,17 @@ void setup() {
|
||||
spore.begin();
|
||||
|
||||
// Demonstrate different logging levels
|
||||
LOG_INFO(spore.ctx, "Example", "Logging example started");
|
||||
LOG_DEBUG(spore.ctx, "Example", "This is a debug message");
|
||||
LOG_WARN(spore.ctx, "Example", "This is a warning message");
|
||||
LOG_ERROR(spore.ctx, "Example", "This is an error message");
|
||||
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(spore.ctx, "Network", "WiFi connection established");
|
||||
LOG_INFO(spore.ctx, "Cluster", "Node discovered: esp-123456");
|
||||
LOG_INFO(spore.ctx, "API", "Server started on port 80");
|
||||
LOG_INFO("Network", "WiFi connection established");
|
||||
LOG_INFO("Cluster", "Node discovered: esp-123456");
|
||||
LOG_INFO("API", "Server started on port 80");
|
||||
|
||||
// Demonstrate event-based logging
|
||||
LogData* logData = new LogData(LogLevel::INFO, "Example", "Event-based logging demonstration");
|
||||
spore.ctx.fire("log/serial", logData);
|
||||
|
||||
// Show that all logging now goes through the centralized system
|
||||
LOG_INFO(spore.ctx, "Example", "All Serial.println calls have been replaced with event-based logging!");
|
||||
LOG_INFO("Example", "All logging now uses the simplified system!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -37,7 +32,7 @@ void loop() {
|
||||
// Log some periodic information
|
||||
static unsigned long lastLog = 0;
|
||||
if (millis() - lastLog > 5000) {
|
||||
LOG_DEBUG(spore.ctx, "Example", "System running - Free heap: " + String(ESP.getFreeHeap()));
|
||||
LOG_DEBUG("Example", "System running - Free heap: " + String(ESP.getFreeHeap()));
|
||||
lastLog = millis();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user