Log api
This commit is contained in:
parent
49415c4173
commit
8984dcb4c5
2 changed files with 5 additions and 6 deletions
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
Reference in a new issue