New logger & removed old unused files

This commit is contained in:
Martin Bauer
2021-08-10 22:47:47 +02:00
parent 28c85f749c
commit ce12c846f6
18 changed files with 179 additions and 534 deletions

View File

@@ -3,6 +3,7 @@
#include <esp_http_server.h>
#include <functional>
#include "Dtypes.h"
#include "Logger.h"
constexpr int MAX_URI_HANDLERS = 25;
@@ -53,7 +54,7 @@ public:
.handler = rawCallback,
.user_ctx = (void *)(&handlerCallbacks_[nextFreeHandler_])};
if (httpd_register_uri_handler(server_, &uri_endpoint_cfg) != ESP_OK)
Serial.println("Failed to register url handler");
LOG_WARNING("Failed to register url handler");
++nextFreeHandler_;
}

View File

@@ -1,5 +1,6 @@
#include "FilesystemAbstraction.h"
#include "WebDAV.h"
#include "Logger.h"
namespace webdav_constants
{
@@ -93,7 +94,7 @@ size_t webdavFileListingSpiffs(char *buffer, size_t maxLength,
toBuffer(MULTISTATUS_END);
if (incomplete)
Serial.println("WebDAV listing response is incomplete, because buffer was too small");
LOG_WARNING("WebDAV listing response is incomplete, because buffer was too small");
return bytesWritten;
}
@@ -122,7 +123,7 @@ std::function<void(httpd_req_t *)> webdavHandler(const char *uriPrefix,
case HTTP_GET:
{
auto filename = uriToFileName(uri, spiffsFolder);
Serial.printf("GET filename %s\n", filename.c_str());
LOG_INFO("GET filename %s", filename.c_str());
auto file = portablefs::open(filename.c_str(), "r");
if (file.available())
{
@@ -154,14 +155,14 @@ std::function<void(httpd_req_t *)> webdavHandler(const char *uriPrefix,
}
case HTTP_OPTIONS:
{
Serial.println("Options request");
LOG_INFO("Options request");
httpd_resp_set_status(req, "204 No Content");
httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, PROPFIND, DELETE, OPTIONS");
httpd_resp_send(req, "", 0);
break;
}
default:
Serial.printf("Sending 404 %d uri %s\n", req->method, req->uri);
LOG_INFO("Sending 404 %d uri %s", req->method, req->uri);
httpd_resp_send_404(req);
}
};