fix: better logging behaviour

This commit is contained in:
Tobias Reisinger 2020-07-26 21:00:05 +02:00
parent 3e6d0333b7
commit 398019afe8
36 changed files with 256 additions and 188 deletions
src/handlers

View file

@ -55,8 +55,6 @@ send_response(struct mg_connection *nc, endpoint_response_t *response)
static void
handle_websocket_request(struct mg_connection *nc, struct http_message *hm)
{
LOG_TRACE("new websocket %.*s request for %.*s\n", hm->method.len, hm->method.p, hm->uri.len, hm->uri.p);
struct mg_str method_websocket_str = mg_mk_str("WEBSOCKET");
endpoint_t *endpoint = router_find_endpoint(hm->uri.p, hm->uri.len, &method_websocket_str);
@ -81,8 +79,6 @@ handle_websocket_request(struct mg_connection *nc, struct http_message *hm)
static void
handle_http_request(struct mg_connection *nc, struct http_message *hm)
{
LOG_TRACE("new http %.*s request for %.*s\n", hm->method.len, hm->method.p, hm->uri.len, hm->uri.p);
endpoint_t *endpoint = router_find_endpoint(hm->uri.p, hm->uri.len, &hm->method);
endpoint_response_t response;
@ -106,7 +102,7 @@ handle_http_request(struct mg_connection *nc, struct http_message *hm)
++request_file;
}
LOG_DEBUG("%s\n", request_file);
LOGGER_DEBUG("%s\n", request_file);
char *request_file_path = malloc(sizeof(char) * (strlen(request_file) + strlen(global_config.content_dir) + 2));
sprintf(request_file_path, "%s/%s", global_config.content_dir, request_file);
int access_result = access(request_file_path, R_OK);