#include "spore/Spore.h" #include "spore/services/LoggingService.h" #include Spore spore; void setup() { // Initialize Spore framework spore.setup(); // Start the framework 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"); // 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"); // 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!"); } void loop() { // Run the Spore framework spore.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())); lastLog = millis(); } delay(100); }