v0.7.12 - Implemented comprehensive debug system with 6 levels (0-5), file:line tracking at TRACE level, deployment script integration, and default level 5 for development

This commit is contained in:
Your Name
2025-10-13 12:44:18 -04:00
parent 49ffc3d99e
commit e3938a2c85
23 changed files with 2163 additions and 622 deletions

View File

@@ -10,13 +10,7 @@
#include "api.h"
#include "embedded_web_content.h"
#include "config.h"
// Forward declarations for logging functions
void log_info(const char* message);
void log_success(const char* message);
void log_error(const char* message);
void log_warning(const char* message);
#include "debug.h"
// Forward declarations for database functions
int store_event(cJSON* event);
@@ -35,7 +29,7 @@ int handle_embedded_file_request(struct lws* wsi, const char* requested_uri) {
snprintf(temp_path, sizeof(temp_path), "/%s", requested_uri + 5); // Add leading slash
file_path = temp_path;
} else {
log_warning("Embedded file request without /api prefix");
DEBUG_WARN("Embedded file request without /api prefix");
lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
return -1;
}
@@ -43,7 +37,7 @@ int handle_embedded_file_request(struct lws* wsi, const char* requested_uri) {
// Get embedded file
embedded_file_t* file = get_embedded_file(file_path);
if (!file) {
log_warning("Embedded file not found");
DEBUG_WARN("Embedded file not found");
lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
return -1;
}
@@ -51,7 +45,7 @@ int handle_embedded_file_request(struct lws* wsi, const char* requested_uri) {
// Allocate session data
struct embedded_file_session_data* session_data = malloc(sizeof(struct embedded_file_session_data));
if (!session_data) {
log_error("Failed to allocate embedded file session data");
DEBUG_ERROR("Failed to allocate embedded file session data");
return -1;
}
@@ -135,7 +129,7 @@ int handle_embedded_file_writeable(struct lws* wsi) {
// Allocate buffer for data transmission
unsigned char *buf = malloc(LWS_PRE + session_data->size);
if (!buf) {
log_error("Failed to allocate buffer for embedded file transmission");
DEBUG_ERROR("Failed to allocate buffer for embedded file transmission");
free(session_data);
lws_set_wsi_user(wsi, NULL);
return -1;
@@ -151,7 +145,7 @@ int handle_embedded_file_writeable(struct lws* wsi) {
free(buf);
if (write_result < 0) {
log_error("Failed to write embedded file data");
DEBUG_ERROR("Failed to write embedded file data");
free(session_data);
lws_set_wsi_user(wsi, NULL);
return -1;