Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
KEP-1605 - reduce impact of log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
paularchard committed Jul 16, 2019
1 parent f323973 commit 87848d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions monitor/monitor.cpp
Expand Up @@ -144,7 +144,7 @@ monitor::format_counter(bzn::statistic stat, uint64_t amount)
void
monitor::send(const std::string& stat)
{
LOG(debug) << "..." << (stat.length() <= 30 ? stat : stat.substr(stat.length() - 30));
LOG(trace) << "..." << (stat.length() <= 30 ? stat : stat.substr(stat.length() - 30));
std::shared_ptr<boost::asio::const_buffer> buffer = std::make_shared<boost::asio::const_buffer>(stat.c_str(), stat.size());
this->socket->async_send_to(*buffer, *(this->monitor_endpoint),
[buffer](const boost::system::error_code& ec, std::size_t /*bytes*/)
Expand All @@ -162,7 +162,7 @@ monitor::maybe_send()
auto threshold = this->time_last_sent + this->options->get_simple_options().get<uint64_t>(option_names::MONITOR_COLLATE_INTERVAL_SECONDS)*1000000;
if (this->clock->microseconds_since_epoch() >= threshold)
{
LOG(debug) << "Sending batched statistics:";
LOG(trace) << "Sending batched statistics:";
for (const auto& pair : this->accumulated_stats)
{
this->send(this->format_counter(pair.first, pair.second));
Expand Down
12 changes: 6 additions & 6 deletions pbft/operations/pbft_persistent_operation.cpp
Expand Up @@ -84,10 +84,10 @@ pbft_persistent_operation::pbft_persistent_operation(uint64_t view, uint64_t seq
switch (response)
{
case storage_result::ok:
LOG(info) << "created persistent operation with prefix " << bzn::bytes_to_debug_string(this->prefix) << "; this is our first record of it";
LOG(trace) << "created persistent operation with prefix " << bzn::bytes_to_debug_string(this->prefix) << "; this is our first record of it";
break;
case storage_result::exists:
LOG(info) << "created persistent operation with prefix " << bzn::bytes_to_debug_string(this->prefix) << "; using existing records";
LOG(trace) << "created persistent operation with prefix " << bzn::bytes_to_debug_string(this->prefix) << "; using existing records";
break;
default:
throw std::runtime_error("failed to write stage of new persistent operation " + storage_result_msg.at(response));
Expand All @@ -102,7 +102,7 @@ pbft_persistent_operation::pbft_persistent_operation(std::shared_ptr<bzn::storag
, prefix(pbft_persistent_operation::generate_prefix(view, sequence, request_hash))
{
assert(this->storage->read(get_uuid(), generate_key(this->prefix, STAGE_KEY)));
LOG(info) << "re-hydrated operation with prefix " << bzn::bytes_to_debug_string(this->prefix);
LOG(trace) << "re-hydrated operation with prefix " << bzn::bytes_to_debug_string(this->prefix);
}

void
Expand Down Expand Up @@ -202,7 +202,7 @@ pbft_persistent_operation::record_request(const bzn_envelope& encoded_request)
{
if (this->transient_request_available)
{
LOG(debug) << "ignoring record of request for operation " << bzn::bytes_to_debug_string(this->prefix) << " because we already have one";
LOG(trace) << "ignoring record of request for operation " << bzn::bytes_to_debug_string(this->prefix) << " because we already have one";
return;
}

Expand All @@ -211,10 +211,10 @@ pbft_persistent_operation::record_request(const bzn_envelope& encoded_request)
switch (response)
{
case storage_result::ok:
LOG(debug) << "recorded request for operation " << bzn::bytes_to_debug_string(this->prefix);
LOG(trace) << "recorded request for operation " << bzn::bytes_to_debug_string(this->prefix);
break;
case storage_result::exists:
LOG(debug) << "ignoring record of request for operation " << bzn::bytes_to_debug_string(this->prefix) << " because we already have one";
LOG(trace) << "ignoring record of request for operation " << bzn::bytes_to_debug_string(this->prefix) << " because we already have one";
break;
case storage_result::value_too_large:
LOG(debug) << "request too large to store: " << encoded_request.SerializeAsString().size() << " bytes, " << bzn::bytes_to_debug_string(this->prefix);
Expand Down
6 changes: 3 additions & 3 deletions pbft/pbft.cpp
Expand Up @@ -222,7 +222,7 @@ pbft::handle_membership_message(const bzn_envelope& msg, std::shared_ptr<bzn::se
void
pbft::handle_message(const pbft_msg& msg, const bzn_envelope& original_msg)
{
LOG(debug) << "Received message: " << msg.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);
LOG(trace) << "Received message: " << msg.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);

std::lock_guard<std::mutex> lock(this->pbft_lock);

Expand Down Expand Up @@ -362,7 +362,7 @@ pbft::handle_request(const bzn_envelope& request_env, const std::shared_ptr<sess
if (this->already_seen_request(request_env, hash))
{
// TODO: send error message to client
LOG(info) << "Rejecting duplicate request: " << request_env.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);
LOG(trace) << "Rejecting duplicate request: " << request_env.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);
return;
}
this->saw_request(request_env, hash);
Expand All @@ -388,7 +388,7 @@ pbft::maybe_record_request(const bzn_envelope &request_env, const std::shared_pt
{
if (request_env.payload_case() == bzn_envelope::PayloadCase::PAYLOAD_NOT_SET || this->crypto->hash(request_env) != op->get_request_hash())
{
LOG(info) << "Not recording request because hashes do not match";
LOG(trace) << "Not recording request because hashes do not match";
return;
}
op->record_request(request_env);
Expand Down

0 comments on commit 87848d8

Please sign in to comment.