You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows how to get a custom access log at the time of request. How can I get the information at the response (I need the return HTTP response code ie 200, 404, 418)
More to the point: It would be a nice enhancement to have the log_access and log_error handlers take the request object as the argument (rather than std::string) so that the handler can format the log message as desired.
Resolved in libhttpserver 2.0.0. You can now observe the response — including the HTTP status code (200/404/418…), bytes sent, and timing — via the response_sent lifecycle hook, rather than only the URL at request time. See examples/clf_access_log.cpp and the README's Lifecycle Hooks section.
Activity
Lotharyx commentedon Mar 14, 2023
More to the point: It would be a nice enhancement to have the log_access and log_error handlers take the request object as the argument (rather than std::string) so that the handler can format the log message as desired.
specs: lifecycle hook bus (DR-012 + TASK-045..052)
TASK-050: fire after_handler / response_sent / request_completed + lo…
TASK-052: Hook bus doc/example/bench/stress closeout
etr commentedon Jul 23, 2026
Resolved in libhttpserver 2.0.0. You can now observe the response — including the HTTP status code (200/404/418…), bytes sent, and timing — via the
response_sentlifecycle hook, rather than only the URL at request time. Seeexamples/clf_access_log.cppand the README's Lifecycle Hooks section.Closing as resolved by 2.0.0.