Skip to content

Commit

Permalink
Merge pull request #1988 from AntelopeIO/extra-logging-main
Browse files Browse the repository at this point in the history
[5.0 -> main] Extra info level logging
  • Loading branch information
heifner authored Dec 14, 2023
2 parents 1335108 + 513b3fb commit 846a418
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 12 additions & 1 deletion libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,18 @@ struct controller_impl {
} // end if exception
} /// end for each block in branch

ilog("successfully switched fork to new head ${new_head_id}", ("new_head_id", new_head->id));
if (fc::logger::get(DEFAULT_LOGGER).is_enabled(fc::log_level::info)) {
auto get_ids = [&](auto& container)->std::string {
std::string ids;
for(auto ritr = container.rbegin(), e = container.rend(); ritr != e; ++ritr) {
ids += std::to_string((*ritr)->block_num) + ":" + (*ritr)->id.str() + ",";
}
if (!ids.empty()) ids.resize(ids.size()-1);
return ids;
};
ilog("successfully switched fork to new head ${new_head_id}, removed {${rm_ids}}, applied {${new_ids}}",
("new_head_id", new_head->id)("rm_ids", get_ids(branches.second))("new_ids", get_ids(branches.first)));
}
} else {
head_changed = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,10 @@ struct session : session_base, std::enable_shared_from_this<session<Plugin, Sock
fc_ilog(plugin.get_logger(),
"pushing result "
"{\"head\":{\"block_num\":${head}},\"last_irreversible\":{\"block_num\":${last_irr}},\"this_block\":{"
"\"block_num\":${this_block}}} to send queue",
("head", result.head.block_num)("last_irr", result.last_irreversible.block_num)(
"this_block", result.this_block ? result.this_block->block_num : fc::variant()));
"\"block_num\":${this_block}, \"block_id\":${this_id}}} to send queue",
("head", result.head.block_num)("last_irr", result.last_irreversible.block_num)
("this_block", result.this_block ? result.this_block->block_num : fc::variant())
("this_id", result.this_block ? fc::variant{result.this_block->block_id} : fc::variant{}));
}

--current_request->max_messages_in_flight;
Expand Down

0 comments on commit 846a418

Please sign in to comment.