diff --git a/audit/audit.cpp b/audit/audit.cpp index 1a0a3223..2752c78a 100644 --- a/audit/audit.cpp +++ b/audit/audit.cpp @@ -209,10 +209,14 @@ audit::send_to_monitor(const std::string& stat) std::shared_ptr buffer = std::make_shared(stat.c_str(), stat.size()); this->socket->async_send_to(*buffer, *(this->monitor_endpoint), - [buffer](const boost::system::error_code& error, std::size_t bytes) - { - LOG(error) << boost::format("UDP send failed, sent %1% bytes, '%2'") % error.message() % bytes; - } + [buffer](const boost::system::error_code& ec, std::size_t bytes) + { + if (ec) + { + LOG(error) << boost::format("UDP send failed, sent %1% bytes, '%2%'") % + ec.message() % bytes; + } + } ); }