From a681a4fcd403d38f314563a95cd7a4899029d982 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 8 Feb 2014 09:33:04 -0800 Subject: [PATCH] Improved logging for insight stat packets --- .../beast/insight/impl/StatsDCollector.cpp | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/beast/beast/insight/impl/StatsDCollector.cpp b/src/beast/beast/insight/impl/StatsDCollector.cpp index 02e25bf9f..9f475a4e2 100644 --- a/src/beast/beast/insight/impl/StatsDCollector.cpp +++ b/src/beast/beast/insight/impl/StatsDCollector.cpp @@ -310,9 +310,6 @@ public: void do_post_buffer (std::string const& buffer) { -#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED - m_journal.trace << std::endl << buffer; -#endif m_data.emplace_back (buffer); } @@ -336,6 +333,22 @@ public: } } + void log (std::vector const& buffers) + { + buffers; +#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED + std::stringstream ss; + for (auto const& buffer : buffers) + { + std::string const s (boost::asio::buffer_cast (buffer), + boost::asio::buffer_size (buffer)); + ss << s; + } + //m_journal.trace << std::endl << ss.str (); + Logger::outputDebugString (ss.str ()); +#endif + } + // Send what we have void send_buffers () { @@ -354,6 +367,9 @@ public: check_precondition (! buffer.empty ()); if (! buffers.empty () && (size + length) > max_packet_size) { +#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED + log (buffers); +#endif m_socket.async_send (buffers, boost::bind ( &StatsDCollectorImp::on_send, this, boost::asio::placeholders::error, @@ -366,6 +382,9 @@ public: } if (! buffers.empty ()) { +#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED + log (buffers); +#endif m_socket.async_send (buffers, boost::bind ( &StatsDCollectorImp::on_send, this, boost::asio::placeholders::error,