MCPcopy Create free account
hub / github.com/CrowCpp/Crow / RequestLogger

Class RequestLogger

examples/example_middleware.cpp:3–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "crow.h"
2
3struct RequestLogger
4{
5 struct context
6 {};
7
8 // This method is run before handling the request
9 void before_handle(crow::request& req, crow::response& /*res*/, context& /*ctx*/)
10 {
11 CROW_LOG_INFO << "Request to:" + req.url;
12 }
13
14 // This method is run after handling the request
15 void after_handle(crow::request& /*req*/, crow::response& /*res*/, context& /*ctx*/)
16 {}
17};
18
19// Per handler middleware has to extend ILocalMiddleware
20// It is called only if enabled

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected