@@ -530,6 +530,8 @@ int main(int argc, char** argv) {
530
530
// Request a summary of lines data for a route
531
531
// TODO Copy pasted from v2/route. There's a lot in common, it should be extracted to common class, just the response parser is different
532
532
server.resource [" ^/v2/summary[/]?$" ][" GET" ]=[&server, &calculator, &dataStatus, &transitData](std::shared_ptr<HttpServer::Response> serverResponse, std::shared_ptr<HttpServer::Request> request) {
533
+ // Have a global id to match the requests in the logs
534
+ static int summaryRequestId = 0 ;
533
535
534
536
std::string response = getFastErrorResponse (dataStatus);
535
537
@@ -551,8 +553,9 @@ int main(int argc, char** argv) {
551
553
{
552
554
parametersWithValues.push_back (std::make_pair (field.first , field.second ));
553
555
}
556
+ int currentRequestId = summaryRequestId++;
554
557
555
- spdlog::info (" -- calculating summary request --" );
558
+ spdlog::info (" -- calculating summary request -- {} " , currentRequestId );
556
559
557
560
try
558
561
{
@@ -572,10 +575,11 @@ int main(int argc, char** argv) {
572
575
}
573
576
}
574
577
575
- spdlog::info (" -- summary request complete --" );
578
+ spdlog::info (" -- summary request complete -- {} " , currentRequestId );
576
579
577
580
} catch (NoRoutingFoundException &e) {
578
581
response = ResultToV2SummaryResponse::noRoutingFoundResponse (queryParams, e.getReason ()).dump (2 );
582
+ spdlog::info (" -- summary request not found -- {}" , currentRequestId);
579
583
}
580
584
581
585
*serverResponse << " HTTP/1.1 200 OK\r\n Access-Control-Allow-Origin: *\r\n Content-Type: application/json; charset=utf-8\r\n Content-Length: " << response.length () << " \r\n\r\n " << response;
@@ -602,6 +606,8 @@ int main(int argc, char** argv) {
602
606
// Routing request for a single origin destination
603
607
// TODO Copy-pasted and adapted from /route/v1/transit. There's still a lot of common code. Application code should be extracted to common functions outside the web server
604
608
server.resource [" ^/v2/accessibility[/]?$" ][" GET" ]=[&server, &calculator, &dataStatus, &transitData](std::shared_ptr<HttpServer::Response> serverResponse, std::shared_ptr<HttpServer::Request> request) {
609
+ // Have a global id to match the requests in the logs
610
+ static int accessibilityRequestId = 0 ;
605
611
606
612
std::string response = getFastErrorResponse (dataStatus);
607
613
@@ -624,7 +630,8 @@ int main(int argc, char** argv) {
624
630
parametersWithValues.push_back (std::make_pair (field.first , field.second ));
625
631
}
626
632
627
- spdlog::info (" -- calculating accessibility request --" );
633
+ int currentRequestId = accessibilityRequestId++;
634
+ spdlog::info (" -- calculating accessibility request -- {}" , currentRequestId);
628
635
629
636
try
630
637
{
@@ -636,10 +643,11 @@ int main(int argc, char** argv) {
636
643
response = ResultToV2AccessibilityResponse::resultToJsonString (*accessibilityResult.get (), queryParams).dump (2 );
637
644
}
638
645
639
- spdlog::info (" -- accessibility request complete --" );
646
+ spdlog::info (" -- accessibility request complete -- {} " , currentRequestId );
640
647
641
648
} catch (NoRoutingFoundException &e) {
642
649
response = ResultToV2AccessibilityResponse::noRoutingFoundResponse (queryParams, e.getReason ()).dump (2 );
650
+ spdlog::info (" -- accessibility request not found -- {}" , currentRequestId);
643
651
}
644
652
645
653
*serverResponse << " HTTP/1.1 200 OK\r\n Access-Control-Allow-Origin: *\r\n Content-Type: application/json; charset=utf-8\r\n Content-Length: " << response.length () << " \r\n\r\n " << response;
0 commit comments