diff --git a/src/httpserver_extension.cpp b/src/httpserver_extension.cpp index 88078f7..5e588aa 100644 --- a/src/httpserver_extension.cpp +++ b/src/httpserver_extension.cpp @@ -384,6 +384,20 @@ void HttpServerStart(DatabaseInstance& db, string_t host, int32_t port, string_t string host_str = host.GetString(); + const char* debug_env = std::getenv("DUCKDB_HTTPSERVER_DEBUG"); + if (debug_env != nullptr && std::string(debug_env) == "1") { + global_state.server->set_logger([](const duckdb_httplib_openssl::Request& req, const duckdb_httplib_openssl::Response& res) { + auto now = std::chrono::system_clock::now(); + auto now_time = std::chrono::system_clock::to_time_t(now); + fprintf(stdout, "[%s] %s %s - %d\n", + std::ctime(&now_time), + req.method.c_str(), + req.path.c_str(), + res.status); + fflush(stdout); + }); + } + const char* run_in_same_thread_env = std::getenv("DUCKDB_HTTPSERVER_FOREGROUND"); bool run_in_same_thread = (run_in_same_thread_env != nullptr && std::string(run_in_same_thread_env) == "1");