diff --git a/include/libp2p/log/simple.hpp b/include/libp2p/log/simple.hpp index c51ef3b8..c83f4ebc 100644 --- a/include/libp2p/log/simple.hpp +++ b/include/libp2p/log/simple.hpp @@ -16,6 +16,7 @@ namespace libp2p { sinks: - name: console type: console + stream: stderr color: true capacity: 4 latency: 0 diff --git a/test-plans/transport_interop/test_plans_ping.cpp b/test-plans/transport_interop/test_plans_ping.cpp index 4864d2d6..85d1d9fa 100644 --- a/test-plans/transport_interop/test_plans_ping.cpp +++ b/test-plans/transport_interop/test_plans_ping.cpp @@ -8,6 +8,8 @@ #include #include "../common.hpp" +using FloatMs = std::chrono::duration; + int main() { setlinebuf(stdout); setlinebuf(stderr); @@ -86,7 +88,6 @@ int main() { host->start(); host->listenProtocol(ping); - ping->start(); if (isDialer) { auto address_str = @@ -121,21 +122,20 @@ int main() { SL_INFO(log, "Ping successful"); auto handShakePlusOneRTT_ms = - std::chrono::duration_cast( - handShakeEnd - handShakeStart); - auto ping_rtt_ms = - std::chrono::duration_cast(ping_rtt); + std::chrono::duration_cast(handShakeEnd - handShakeStart); + auto ping_rtt_ms = std::chrono::duration_cast(ping_rtt); - SL_INFO(log, "latency:"); - SL_INFO( - log, " handshake_plus_one_rtt: {}", handShakePlusOneRTT_ms.count()); - SL_INFO(log, " ping_rtt: {}", ping_rtt_ms.count()); - SL_INFO(log, " unit: ms"); + fmt::println("latency:"); + fmt::println(" handshake_plus_one_rtt: {}", + handShakePlusOneRTT_ms.count()); + fmt::println(" ping_rtt: {}", ping_rtt_ms.count()); + fmt::println(" unit: ms"); io_context->stop(); }); io_context->run_for(timeout.remaining()); } else { + ping->start(); TRY_OR_SL_FATAL(host->listen(sample_peer.listen), log, "Error listening on {}: {}",