Add Visione backend foundation

This commit is contained in:
gabdevele
2026-06-02 19:22:00 +02:00 Unverified
commit 580789ac83
52 changed files with 5008 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "RequestLogger.h"
#include <drogon/drogon.h>
namespace
{
const auto registeredClassName = RequestLogger::classTypeName();
}
void RequestLogger::initAndStart(const Json::Value &config)
{
includeQuery_ = config.get("include_query", true).asBool();
LOG_INFO << "RequestLogger plugin initialized";
drogon::app().registerPreSendingAdvice(
[this](const drogon::HttpRequestPtr &req,
const drogon::HttpResponsePtr &resp) {
auto url = req->path();
if (includeQuery_ && !req->query().empty())
{
url += "?";
url += req->query();
}
LOG_INFO << req->methodString() << " " << url << " -> "
<< static_cast<int>(resp->statusCode()) << " from "
<< req->getPeerAddr().toIpPort();
});
}
void RequestLogger::shutdown()
{
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include <drogon/plugins/Plugin.h>
class RequestLogger : public drogon::Plugin<RequestLogger>
{
public:
void initAndStart(const Json::Value &config) override;
void shutdown() override;
private:
bool includeQuery_{true};
};