Always log should_log in classes which manage their own log timing
This commit is contained in:
		
					parent
					
						
							
								a4c8c5ef65
							
						
					
				
			
			
				commit
				
					
						af3bb80df2
					
				
			
		
					 4 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -268,7 +268,7 @@ void nano::block_processor::process_batch (std::unique_lock<std::mutex> & lock_a
 | 
			
		|||
		if (log_this_record)
 | 
			
		||||
		{
 | 
			
		||||
			first_time = false;
 | 
			
		||||
			node.logger.try_log (boost::str (boost::format ("%1% blocks (+ %2% state blocks) (+ %3% forced) in processing queue") % blocks.size () % state_blocks.size () % forced.size ()));
 | 
			
		||||
			node.logger.always_log (boost::str (boost::format ("%1% blocks (+ %2% state blocks) (+ %3% forced) in processing queue") % blocks.size () % state_blocks.size () % forced.size ()));
 | 
			
		||||
		}
 | 
			
		||||
		nano::unchecked_info info;
 | 
			
		||||
		bool force (false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -312,7 +312,7 @@ void nano::frontier_req_client::received_frontier (boost::system::error_code con
 | 
			
		|||
		}
 | 
			
		||||
		if (connection->attempt->should_log ())
 | 
			
		||||
		{
 | 
			
		||||
			connection->node->logger.try_log (boost::str (boost::format ("Received %1% frontiers from %2%") % std::to_string (count) % connection->socket->remote_endpoint ()));
 | 
			
		||||
			connection->node->logger.always_log (boost::str (boost::format ("Received %1% frontiers from %2%") % std::to_string (count) % connection->socket->remote_endpoint ()));
 | 
			
		||||
		}
 | 
			
		||||
		auto transaction (connection->node->store.tx_begin_read ());
 | 
			
		||||
		if (!account.is_zero ())
 | 
			
		||||
| 
						 | 
				
			
			@ -474,7 +474,7 @@ void nano::bulk_pull_client::request ()
 | 
			
		|||
	else if (connection->node->config.logging.network_logging () && connection->attempt->should_log ())
 | 
			
		||||
	{
 | 
			
		||||
		std::unique_lock<std::mutex> lock (connection->attempt->mutex);
 | 
			
		||||
		connection->node->logger.try_log (boost::str (boost::format ("%1% accounts in pull queue") % connection->attempt->pulls.size ()));
 | 
			
		||||
		connection->node->logger.always_log (boost::str (boost::format ("%1% accounts in pull queue") % connection->attempt->pulls.size ()));
 | 
			
		||||
	}
 | 
			
		||||
	auto this_l (shared_from_this ());
 | 
			
		||||
	connection->socket->async_write (buffer, [this_l](boost::system::error_code const & ec, size_t size_a) {
 | 
			
		||||
| 
						 | 
				
			
			@ -807,7 +807,7 @@ void nano::bulk_pull_account_client::request ()
 | 
			
		|||
	else if (connection->node->config.logging.network_logging () && connection->attempt->should_log ())
 | 
			
		||||
	{
 | 
			
		||||
		std::unique_lock<std::mutex> lock (connection->attempt->mutex);
 | 
			
		||||
		connection->node->logger.try_log (boost::str (boost::format ("%1% accounts in pull queue") % connection->attempt->wallet_accounts.size ()));
 | 
			
		||||
		connection->node->logger.always_log (boost::str (boost::format ("%1% accounts in pull queue") % connection->attempt->wallet_accounts.size ()));
 | 
			
		||||
	}
 | 
			
		||||
	auto this_l (shared_from_this ());
 | 
			
		||||
	connection->socket->async_write (buffer, [this_l](boost::system::error_code const & ec, size_t size_a) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,12 +36,12 @@ void nano::port_mapping::refresh_devices ()
 | 
			
		|||
		}
 | 
			
		||||
		if (check_count % 15 == 0)
 | 
			
		||||
		{
 | 
			
		||||
			node.logger.try_log (boost::str (boost::format ("UPnP local address: %1%, discovery: %2%, IGD search: %3%") % local_address.data () % discover_error % igd_error));
 | 
			
		||||
			node.logger.always_log (boost::str (boost::format ("UPnP local address: %1%, discovery: %2%, IGD search: %3%") % local_address.data () % discover_error % igd_error));
 | 
			
		||||
			if (node.config.logging.upnp_details_logging ())
 | 
			
		||||
			{
 | 
			
		||||
				for (auto i (devices); i != nullptr; i = i->pNext)
 | 
			
		||||
				{
 | 
			
		||||
					node.logger.try_log (boost::str (boost::format ("UPnP device url: %1% st: %2% usn: %3%") % i->descURL % i->st % i->usn));
 | 
			
		||||
					node.logger.always_log (boost::str (boost::format ("UPnP device url: %1% st: %2% usn: %3%") % i->descURL % i->st % i->usn));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ void nano::port_mapping::refresh_mapping ()
 | 
			
		|||
			auto add_port_mapping_error (UPNP_AddAnyPortMapping (urls.controlURL, data.first.servicetype, node_port.c_str (), node_port.c_str (), address.to_string ().c_str (), nullptr, protocol.name, nullptr, std::to_string (mapping_timeout).c_str (), actual_external_port.data ()));
 | 
			
		||||
			if (check_count % 15 == 0)
 | 
			
		||||
			{
 | 
			
		||||
				node.logger.try_log (boost::str (boost::format ("UPnP %1% port mapping response: %2%, actual external port %3%") % protocol.name % add_port_mapping_error % actual_external_port.data ()));
 | 
			
		||||
				node.logger.always_log (boost::str (boost::format ("UPnP %1% port mapping response: %2%, actual external port %3%") % protocol.name % add_port_mapping_error % actual_external_port.data ()));
 | 
			
		||||
			}
 | 
			
		||||
			if (add_port_mapping_error == UPNPCOMMAND_SUCCESS)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ int nano::port_mapping::check_mapping ()
 | 
			
		|||
			}
 | 
			
		||||
			if (check_count % 15 == 0)
 | 
			
		||||
			{
 | 
			
		||||
				node.logger.try_log (boost::str (boost::format ("UPnP %1% mapping verification response: %2%, external ip response: %3%, external ip: %4%, internal ip: %5%, remaining lease: %6%") % protocol.name % verify_port_mapping_error % external_ip_error % external_address.data () % address.to_string () % remaining_mapping_duration.data ()));
 | 
			
		||||
				node.logger.always_log (boost::str (boost::format ("UPnP %1% mapping verification response: %2%, external ip response: %3%, external ip: %4%, internal ip: %5%, remaining lease: %6%") % protocol.name % verify_port_mapping_error % external_ip_error % external_address.data () % address.to_string () % remaining_mapping_duration.data ()));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -140,7 +140,7 @@ void nano::port_mapping::check_mapping_loop ()
 | 
			
		|||
		wait_duration = 300;
 | 
			
		||||
		if (check_count < 10)
 | 
			
		||||
		{
 | 
			
		||||
			node.logger.try_log (boost::str (boost::format ("UPnP No IGD devices found")));
 | 
			
		||||
			node.logger.always_log (boost::str (boost::format ("UPnP No IGD devices found")));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	++check_count;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1560,7 +1560,7 @@ void nano::wallets::foreach_representative (nano::transaction const & transactio
 | 
			
		|||
							if (last_log < std::chrono::steady_clock::now () - std::chrono::seconds (60))
 | 
			
		||||
							{
 | 
			
		||||
								last_log = std::chrono::steady_clock::now ();
 | 
			
		||||
								node.logger.try_log (boost::str (boost::format ("Representative locked inside wallet %1%") % i->first.to_string ()));
 | 
			
		||||
								node.logger.always_log (boost::str (boost::format ("Representative locked inside wallet %1%") % i->first.to_string ()));
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue