Made logging robust to bad messages. Fixed a bunch of bad messages.
This commit is contained in:
1 parent
792cd7df97
commit
0284dc2f73
5 files changed
+15
-5
No files matched your search
@@ -10,7 +10,17 @@ namespace log {
|
||||
|
||||
template <class Tuple, std::size_t... Is>
|
||||
std::string format_tuple(const char*msg_template, Tuple const &t,std::index_sequence<Is...>)
|
||||
{return fmt::format(msg_template,std::get<Is>(t)...);}
|
||||
{
|
||||
try {
|
||||
return fmt::format(msg_template,std::get<Is>(t)...);
|
||||
}
|
||||
catch (fmt::FormatError const &e)
|
||||
{
|
||||
return fmt::format("Bad log message template: '{}' Error: '{}'",
|
||||
msg_template,e.what());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <size_t SZ, typename... Args>
|
||||
std::string unpack_msg_args(std::array<uint8_t,SZ> const&buffer, const char*msg_template)
|
||||
|
||||
@@ -104,7 +104,7 @@ void LocalNode::subscribe (NodeID const&nid, TableID const&tid,SubscriptionID co
|
||||
|
||||
void LocalNode::notify(NodeID const&nid,TableID const&tid,SubscriptionID const&sid, Update const&u)
|
||||
{
|
||||
LOG(QBus,Diag,"Localnode {} received notify {} from {} for {} (sid: {})",
|
||||
LOG(QBus,Diag,"Localnode {} received notify from {} for {} (sid: {})",
|
||||
me->my_id.value() ,nid.value(), tid.value(),sid.value());
|
||||
|
||||
on_notify(tid,sid,u);
|
||||
|
||||
@@ -123,7 +123,7 @@ void QBConnection::check_hbs()
|
||||
if (!is_send_in_flight() &&
|
||||
datetime::is_at_least_msecs_old (me->last_sent_ts, me->cfg.hb_period_msecs())) {
|
||||
|
||||
LOG(QBus,Diag,"{0} sending HB to {}", me->my_desc ,me->remote_desc );
|
||||
LOG(QBus,Diag,"{} sending HB to {}", me->my_desc ,me->remote_desc );
|
||||
me->pending_send.add_op()->mutable_heartbeat();
|
||||
try_send_pending();
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void Router::remove_neighbour(NodeID const&removed_neighbour_id)
|
||||
|
||||
void Router::advertise(NodeID const& sender,TableID const&tid,Advertisement const&ad)
|
||||
{
|
||||
LOG(QBus,Diag, "{} received advertisement from nid: { tid: {} ad topic: {}",
|
||||
LOG(QBus,Diag, "{} received advertisement from nid: {} tid: {} ad topic: {}",
|
||||
id().value() , sender.value() , tid.value() , ad.topic.value());
|
||||
|
||||
NoReenter nr(me->inside);
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
private:
|
||||
void sync_send(RPCRequestPtr const &req,OnRPCReply const&on_reply)
|
||||
{
|
||||
LOG(QBus,Diag, "Trying to sync_send {} bytes {} to {}",
|
||||
LOG(QBus,Diag, "Trying to sync_send {} bytes to {}",
|
||||
req->value().size() , service_name.value());
|
||||
|
||||
bts_assert (on_qb_thread());
|
||||
|
||||
Reference in new issue
Block a user