fix logging

pull/1/head
Jeff Becker 6 years ago
parent 5649d261ae
commit 0724479eba
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -3,6 +3,7 @@
#include <llarp/crypto.h>
#include <sodium.h>
#include <iomanip>
#include <iostream>
namespace llarp
@ -37,22 +38,19 @@ namespace llarp
return buf.b[idx];
}
std::ostream&
operator<<(std::ostream& out) const
std::string
Hex() const
{
char buf[(1 + sz) * 2] = {0};
size_t idx = 0;
char* ptr = buf;
char* end = ptr + (sz * 2);
std::stringstream out;
std::string str;
size_t idx = 0;
while(idx < sz)
{
auto wrote = snprintf(ptr, end - ptr, "%.2x", buf.b[idx]);
if(wrote == -1)
break;
++idx;
ptr += wrote;
out << std::hex << std::setw(2) << std::setfill('0')
<< (int)buf.b[++idx];
}
return out << std::string(buf);
str = out.str();
return str;
}
bool

@ -69,7 +69,7 @@ namespace llarp
bool
LinkIntroMessage::HandleMessage(llarp_router* router) const
{
llarp::Info(__FILE__, "got LIM from ", remote);
llarp::Info(__FILE__, "got LIM from ", remote.Hex());
return true;
}
}

@ -63,7 +63,7 @@ llarp_router::SendToOrQueue(const llarp::RouterID &remote,
if(!llarp_nodedb_find_rc(nodedb, &rc, k))
{
llarp::Warn(__FILE__, "cannot find router ", remote,
llarp::Warn(__FILE__, "cannot find router ", remote.Hex(),
" locally so we are dropping ", msgs.size(),
" messages to them");

Loading…
Cancel
Save