Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/web/api_handlers_system_logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,8 @@ void handle_get_system_logs(const http_request_t *req, http_response_t *res) {

// Get system logs
char **logs = NULL;
// max_log_count is the input (maximum number of logs requested)
// actual_log_count is the output (actual number of logs returned) by get_json_logs_tail().
int max_log_count = DEFAULT_MAX_LOG_ENTRIES; // Input: maximum number of logs to return
int actual_log_count = max_log_count; // Will be updated by get_json_logs_tail()
int actual_log_count = 0; // Will be updated by get_json_logs_tail()

// Second argument is the optional source/filter/context; NULL means "no specific filter" (use default system logs)
// Note: actual_log_count is updated by get_json_logs_tail() to the actual number of logs returned.
Expand Down Expand Up @@ -397,8 +395,8 @@ void handle_get_system_logs(const http_request_t *req, http_response_t *res) {
cJSON *message_json = cJSON_GetObjectItem(log_json, "message");

const char *timestamp = timestamp_json && cJSON_IsString(timestamp_json) ? timestamp_json->valuestring : "Unknown";
const char *log_level = level_json && cJSON_IsString(level_json) ? level_json->valuestring : "info";
const char *message = message_json && cJSON_IsString(message_json) ? message_json->valuestring : "";
const char *log_level = level_json && cJSON_IsString(level_json) ? level_json->valuestring : "Unknown";
const char *message = message_json && cJSON_IsString(message_json) ? message_json->valuestring : "Unknown";

// Check if this log meets the minimum level
if (log_level_meets_minimum(log_level, level)) {
Expand Down
Loading