Skip to content

Commit

Permalink
Replace legacy logging calls
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 9, 2024
1 parent f0667d7 commit 2cfe2ea
Show file tree
Hide file tree
Showing 105 changed files with 1,248 additions and 1,387 deletions.
96 changes: 48 additions & 48 deletions nano/core_test/block_store.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions nano/core_test/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ TEST (bootstrap_processor, lazy_hash_pruning)
ASSERT_EQ (5, node1->ledger.cache.block_count);
ASSERT_EQ (5, node1->ledger.cache.cemented_count);
// Pruning action
node1->ledger_pruning (2, false, false);
node1->ledger_pruning (2, false);
ASSERT_EQ (9, node0->ledger.cache.block_count);
ASSERT_EQ (0, node0->ledger.cache.pruned_count);
ASSERT_EQ (5, node1->ledger.cache.block_count);
Expand Down Expand Up @@ -1326,7 +1326,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block)
ASSERT_EQ (5, node1->ledger.cache.block_count);
ASSERT_EQ (5, node1->ledger.cache.cemented_count);
// Pruning action
node1->ledger_pruning (2, false, false);
node1->ledger_pruning (2, false);
ASSERT_EQ (5, node1->ledger.cache.block_count);
ASSERT_EQ (1, node1->ledger.cache.pruned_count);
ASSERT_TRUE (node1->ledger.block_or_pruned_exists (send1->hash ())); // true for pruned
Expand Down Expand Up @@ -2031,7 +2031,7 @@ TEST (bulk, DISABLED_genesis_pruning)
election->force_confirm ();
}
ASSERT_TIMELY (2s, node1->active.empty () && node1->block_confirmed (send3->hash ()));
node1->ledger_pruning (2, false, false);
node1->ledger_pruning (2, false);
ASSERT_EQ (2, node1->ledger.cache.pruned_count);
ASSERT_EQ (4, node1->ledger.cache.block_count);
ASSERT_TRUE (node1->ledger.block_or_pruned_exists (send1->hash ())); // true for pruned
Expand Down
21 changes: 11 additions & 10 deletions nano/core_test/bootstrap_ascending.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/tomlconfig.hpp>
#include <nano/node/bootstrap_ascending/service.hpp>
Expand All @@ -24,7 +25,7 @@ nano::block_hash random_hash ()
TEST (account_sets, construction)
{
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -34,7 +35,7 @@ TEST (account_sets, empty_blocked)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -45,7 +46,7 @@ TEST (account_sets, block)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -57,7 +58,7 @@ TEST (account_sets, unblock)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -71,7 +72,7 @@ TEST (account_sets, priority_base)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -82,7 +83,7 @@ TEST (account_sets, priority_blocked)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -95,7 +96,7 @@ TEST (account_sets, priority_unblock_keep)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -113,7 +114,7 @@ TEST (account_sets, priority_up_down)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -128,7 +129,7 @@ TEST (account_sets, priority_down_sat)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -141,7 +142,7 @@ TEST (account_sets, saturate_priority)
{
nano::account account{ 1 };
nano::stats stats;
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand Down
31 changes: 14 additions & 17 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <nano/lib/logging.hpp>
#include <nano/node/election.hpp>
#include <nano/node/make_store.hpp>
#include <nano/test_common/system.hpp>
Expand Down Expand Up @@ -1159,8 +1160,7 @@ TEST (confirmation_heightDeathTest, rollback_added_block)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::logger_mt logger;
nano::logging logging;
nano::nlogger logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand All @@ -1186,13 +1186,13 @@ TEST (confirmation_heightDeathTest, rollback_added_block)
uint64_t batch_write_size = 2048;
std::atomic<bool> stopped{ false };
nano::confirmation_height_unbounded unbounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });

// Processing a block which doesn't exist should bail
ASSERT_DEATH_IF_SUPPORTED (unbounded_processor.process (send), "");

nano::confirmation_height_bounded bounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
// Processing a block which doesn't exist should bail
ASSERT_DEATH_IF_SUPPORTED (bounded_processor.process (send), "");
}
Expand Down Expand Up @@ -1251,8 +1251,7 @@ TEST (confirmation_heightDeathTest, modified_chain)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::logging logging;
nano::logger_mt logger;
nano::nlogger logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand All @@ -1279,7 +1278,7 @@ TEST (confirmation_heightDeathTest, modified_chain)
uint64_t batch_write_size = 2048;
std::atomic<bool> stopped{ false };
nano::confirmation_height_bounded bounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });

{
// This reads the blocks in the account, but prevents any writes from occuring yet
Expand All @@ -1298,7 +1297,7 @@ TEST (confirmation_heightDeathTest, modified_chain)
store->confirmation_height.put (store->tx_begin_write (), nano::dev::genesis->account (), { 1, nano::dev::genesis->hash () });

nano::confirmation_height_unbounded unbounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });

{
// This reads the blocks in the account, but prevents any writes from occuring yet
Expand Down Expand Up @@ -1329,8 +1328,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::logging logging;
nano::logger_mt logger;
nano::nlogger logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -1368,7 +1366,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed)
uint64_t batch_write_size = 2048;
std::atomic<bool> stopped{ false };
nano::confirmation_height_unbounded unbounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });

{
// This reads the blocks in the account, but prevents any writes from occuring yet
Expand All @@ -1388,7 +1386,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed)
store->confirmation_height.put (store->tx_begin_write (), nano::dev::genesis->account (), { 1, nano::dev::genesis->hash () });

nano::confirmation_height_bounded bounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [] (auto const &) {}, [] (auto const &) {}, [] () { return 0; });

{
// This reads the blocks in the account, but prevents any writes from occuring yet
Expand Down Expand Up @@ -2041,7 +2039,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)
// Don't test this in rocksdb mode
GTEST_SKIP ();
}
nano::logger_mt logger;
nano::nlogger logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand All @@ -2050,7 +2048,6 @@ TEST (confirmation_height, unbounded_block_cache_iteration)
nano::write_database_queue write_database_queue (false);
boost::latch initialized_latch{ 0 };
nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () };
nano::logging logging;
nano::keypair key1;
nano::block_builder builder;
auto send = builder
Expand All @@ -2076,7 +2073,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, *send1).code);
}

nano::confirmation_height_processor confirmation_height_processor (ledger, write_database_queue, 10ms, logging, logger, initialized_latch, nano::confirmation_height_mode::unbounded);
nano::confirmation_height_processor confirmation_height_processor (ledger, write_database_queue, 10ms, logger, initialized_latch, nano::confirmation_height_mode::unbounded);
nano::timer<> timer;
timer.start ();
{
Expand Down Expand Up @@ -2105,7 +2102,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)

TEST (confirmation_height, pruned_source)
{
nano::logger_mt logger;
nano::nlogger logger;
nano::logging logging;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
Expand Down Expand Up @@ -2180,7 +2177,7 @@ TEST (confirmation_height, pruned_source)
std::atomic<bool> stopped{ false };
bool first_time{ true };
nano::confirmation_height_bounded bounded_processor (
ledger, write_database_queue, 10ms, logging, logger, stopped, batch_write_size, [&] (auto const & cemented_blocks_a) {
ledger, write_database_queue, 10ms, logger, stopped, batch_write_size, [&] (auto const & cemented_blocks_a) {
if (first_time)
{
// Prune the send
Expand Down
3 changes: 2 additions & 1 deletion nano/core_test/core_test_main.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "gtest/gtest.h"

#include <nano/lib/logging.hpp>
#include <nano/node/common.hpp>
#include <nano/node/logging.hpp>
#include <nano/secure/utility.hpp>
Expand All @@ -19,7 +20,7 @@ void force_nano_dev_network ();

GTEST_API_ int main (int argc, char ** argv)
{
printf ("Running main() from core_test_main.cc\n");
nano::initialize_logging (nano::log::preset::tests);
nano::set_file_descriptor_limit (OPEN_FILE_DESCRIPTORS_LIMIT);
nano::force_nano_dev_network ();
nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard;
Expand Down
25 changes: 13 additions & 12 deletions nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <nano/lib/logging.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/threading.hpp>
#include <nano/node/election.hpp>
Expand Down Expand Up @@ -817,7 +818,7 @@ TEST (ledger, representation)

TEST (ledger, double_open)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4161,7 +4162,7 @@ TEST (ledger, block_hash_account_conflict)

TEST (ledger, could_fit)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4799,7 +4800,7 @@ TEST (ledger, dependents_confirmed)

TEST (ledger, dependents_confirmed_pruning)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4989,7 +4990,7 @@ TEST (ledger, cache)

TEST (ledger, pruning_action)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5073,7 +5074,7 @@ TEST (ledger, pruning_action)

TEST (ledger, pruning_large_chain)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5128,7 +5129,7 @@ TEST (ledger, pruning_large_chain)

TEST (ledger, pruning_source_rollback)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5216,7 +5217,7 @@ TEST (ledger, pruning_source_rollback)

TEST (ledger, pruning_source_rollback_legacy)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5329,7 +5330,7 @@ TEST (ledger, pruning_source_rollback_legacy)

TEST (ledger, pruning_process_error)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5376,7 +5377,7 @@ TEST (ledger, pruning_process_error)

TEST (ledger, pruning_legacy_blocks)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5462,7 +5463,7 @@ TEST (ledger, pruning_legacy_blocks)

TEST (ledger, pruning_safe_functions)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5523,7 +5524,7 @@ TEST (ledger, pruning_safe_functions)

TEST (ledger, hash_root_random)
{
nano::logger_mt logger;
nano::nlogger logger;
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5587,7 +5588,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
{
nano::test::system system{};
auto path = nano::unique_path ();
nano::logger_mt logger{};
nano::nlogger logger;
boost::asio::ip::address_v6 address (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"));
uint16_t port = 100;
nano::store::lmdb::component store{ logger, path / "data.ldb", nano::dev::constants };
Expand Down
Loading

0 comments on commit 2cfe2ea

Please sign in to comment.