diff --git a/ESPFirewall/lib/Firewall/src/API.cpp b/ESPFirewall/lib/Firewall/src/API.cpp index 5fefc17..a954adf 100644 --- a/ESPFirewall/lib/Firewall/src/API.cpp +++ b/ESPFirewall/lib/Firewall/src/API.cpp @@ -16,8 +16,8 @@ namespace fw this->serverCache = new ServerSessions(5); #endif this->setup_routing(cert, key); - Serial.printf("Starting server on port %i...\n", port); this->server->begin(); + Serial.printf("%s listening on port %i\n", log, port); } API::~API() @@ -43,13 +43,13 @@ namespace fw { if (!username || *username == 0x00 || strlen(username) > CREDENTIALS_LENGTH) { - Serial.println("Username too long or missing!"); + Serial.printf("%s Username too long or missing!\n", log); return ERROR; } strncpy(credentials.username, username, CREDENTIALS_LENGTH); if (!password || *password == 0x00 || strlen(password) > CREDENTIALS_LENGTH) { - Serial.println("Password too long or missing!"); + Serial.printf("%s Password too long or missing!\n", log); return ERROR; } strncpy(credentials.password, password, CREDENTIALS_LENGTH); @@ -116,9 +116,7 @@ namespace fw void API::not_found_handler() { - this->json_message_response( - "see " + get_url_base() + "/api for available routes", - 404); + this->json_message_response("see " + get_url_base() + "/api for available routes", 404); } void API::get_endpoint_list_handler() diff --git a/ESPFirewall/lib/Firewall/src/API.hpp b/ESPFirewall/lib/Firewall/src/API.hpp index ee50ed2..cbe59ed 100644 --- a/ESPFirewall/lib/Firewall/src/API.hpp +++ b/ESPFirewall/lib/Firewall/src/API.hpp @@ -33,6 +33,7 @@ namespace fw String api_ip = "0.0.0.0"; uint16_t api_port; String json_response_type = "application/json; charset=utf-8"; + String log = "[API]"; String get_url_base(); ok_t setup_auth(const char *username, const char *password);