diff --git a/rai/node/rpc.cpp b/rai/node/rpc.cpp index 6eaa3199..cec46314 100755 --- a/rai/node/rpc.cpp +++ b/rai/node/rpc.cpp @@ -2025,8 +2025,9 @@ void rai::rpc_connection::parse_connection () { if (!ec) { + auto start (std::chrono::system_clock::now ()); auto version (this_l->request.version); - auto response_handler ([this_l, version] (boost::property_tree::ptree const & tree_a) + auto response_handler ([this_l, version, start] (boost::property_tree::ptree const & tree_a) { std::stringstream ostream; boost::property_tree::write_json (ostream, tree_a); @@ -2041,11 +2042,19 @@ void rai::rpc_connection::parse_connection () beast::http::async_write (this_l->socket, this_l->res, [this_l] (boost::system::error_code const & ec) { }); + if (this_l->node->config.logging.log_rpc ()) + { + BOOST_LOG (this_l->node->log) << boost::str (boost::format ("RPC request %2% completed in: %1% microseconds") % std::chrono::duration_cast (std::chrono::system_clock::now () - start).count () % boost::io::group (std::hex, std::showbase, reinterpret_cast (this_l.get ()))); + } }); if (this_l->request.method () == "POST") { auto handler (std::make_shared (*this_l->node, this_l->rpc, this_l->request.body, response_handler)); handler->process_request (); + if (this_l->node->config.logging.log_rpc ()) + { + BOOST_LOG (this_l->node->log) << boost::str (boost::format ("RPC request %2% serviced in: %1% microseconds") % std::chrono::duration_cast (std::chrono::system_clock::now () - start).count () % boost::io::group (std::hex, std::showbase, reinterpret_cast (this_l.get ()))); + } } else {