// Define Log Levels
#define LOG_LEVEL_NONE    0  // No logs
#define LOG_LEVEL_ERROR   1  // Errors only
#define LOG_LEVEL_WARNING 2  // Warnings and errors
#define LOG_LEVEL_INFO    3  // Info, warnings, and errors
#define LOG_LEVEL_DEBUG   4  // All logs (full debugging)

// Set the active log level
#define ACTIVE_LOG_LEVEL LOG_LEVEL_DEBUG

// Check if the log level is enabled
#define LOG_LEVEL_ENABLED(level) (ACTIVE_LOG_LEVEL >= level)

// Macro to control logging based on the active level
#if LOG_LEVEL_ENABLED(LOG_LEVEL_ERROR)
    #define LOG_ERROR(...) { Serial.print("[ERROR] - "); Serial.printf(__VA_ARGS__); Serial.println(); }
#else
    #define LOG_ERROR(...) // No logging if level is not enabled
#endif

#if LOG_LEVEL_ENABLED(LOG_LEVEL_WARNING)
    #define LOG_WARNING(...) { Serial.print("[WARNING] - "); Serial.printf(__VA_ARGS__); Serial.println(); }
#else
    #define LOG_WARNING(...) // No logging if level is not enabled
#endif

#if LOG_LEVEL_ENABLED(LOG_LEVEL_INFO)
    #define LOG_INFO(...) { Serial.print("[INFO] - "); Serial.printf(__VA_ARGS__); Serial.println(); }
#else
    #define LOG_INFO(...) // No logging if level is not enabled
#endif

#if LOG_LEVEL_ENABLED(LOG_LEVEL_DEBUG)
    #define LOG_DEBUG(...) { Serial.print("[DEBUG] - "); Serial.printf(__VA_ARGS__); Serial.println(); }
#else
    #define LOG_DEBUG(...) // No logging if level is not enabled
#endif
