Use spdlog and create a formatter for Address

This commit is contained in:
Tyler Neely 2022-08-01 10:23:25 +00:00
parent 66ef5b2072
commit b127f6f345
3 changed files with 10 additions and 2 deletions

View File

@ -13,8 +13,10 @@
#include <compare>
#include <fmt/format.h>
#include <boost/asio/ip/tcp.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
namespace memgraph::io {
struct Address {
@ -52,5 +54,10 @@ struct Address {
return unique_id < other.unique_id;
}
}
std::string ToString() const {
return fmt::format("Address {{ unique_id: {}, last_known_ip: {}, last_known_port: {} }}",
boost::uuids::to_string(unique_id), last_known_ip.to_string(), last_known_port);
}
};
}; // namespace memgraph::io

View File

@ -260,7 +260,8 @@ class SimulatorHandle {
for (auto &[promise_key, dop] : promises_) {
// TODO(tyler) queue this up and drop it after its deadline
if (dop.deadline < now) {
std::cout << "timing out request" << std::endl;
spdlog::debug("timing out request from requester {} to replier {}.", promise_key.requester_address.ToString(),
promise_key.replier_address.ToString());
DeadlineAndOpaquePromise dop = std::move(promises_.at(promise_key));
promises_.erase(promise_key);

View File

@ -115,7 +115,7 @@ class Io {
Time Now() { return implementation_.Now(); }
/// Returns true of the system should shut-down.
bool ShouldShutDown() { return implementation_.ShouldShutDown(); }
const bool ShouldShutDown() { return implementation_.ShouldShutDown(); }
/// Returns a random number within the specified distribution.
template <class D = std::poisson_distribution<>, class Return = uint64_t>