Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0 -> main] Extra info level logging #1988

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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