From f4fee1dd67c73dde0a352fb0b8ef52e665d08891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:53:59 +0100 Subject: [PATCH] Rename back to `nano::logger` --- nano/core_test/block_store.cpp | 96 +++++++++---------- nano/core_test/bootstrap_ascending.cpp | 20 ++-- nano/core_test/confirmation_height.cpp | 10 +- nano/core_test/core_test_main.cc | 2 +- nano/core_test/ledger.cpp | 24 ++--- nano/core_test/node.cpp | 2 +- nano/core_test/processor_service.cpp | 4 +- nano/core_test/work_pool.cpp | 2 +- nano/lib/logging.cpp | 30 +++--- nano/lib/logging.hpp | 8 +- nano/lib/tlsconfig.cpp | 4 +- nano/lib/tlsconfig.hpp | 4 +- nano/load_test/entry.cpp | 2 +- nano/nano_node/daemon.cpp | 38 ++++---- nano/nano_node/daemon.hpp | 2 +- nano/nano_node/entry.cpp | 16 ++-- nano/nano_rpc/entry.cpp | 16 ++-- nano/nano_wallet/entry.cpp | 16 ++-- nano/node/blockprocessor.cpp | 10 +- nano/node/bootstrap/bootstrap_attempt.cpp | 4 +- nano/node/bootstrap/bootstrap_bulk_pull.cpp | 40 ++++---- nano/node/bootstrap/bootstrap_bulk_push.cpp | 16 ++-- nano/node/bootstrap/bootstrap_connections.cpp | 16 ++-- nano/node/bootstrap/bootstrap_frontier.cpp | 18 ++-- nano/node/bootstrap/bootstrap_lazy.cpp | 6 +- nano/node/bootstrap/bootstrap_legacy.cpp | 6 +- nano/node/cli.cpp | 2 +- nano/node/confirmation_height_bounded.cpp | 8 +- nano/node/confirmation_height_bounded.hpp | 4 +- nano/node/confirmation_height_processor.cpp | 6 +- nano/node/confirmation_height_processor.hpp | 2 +- nano/node/confirmation_height_unbounded.cpp | 8 +- nano/node/confirmation_height_unbounded.hpp | 4 +- nano/node/distributed_work.cpp | 26 ++--- nano/node/epoch_upgrader.cpp | 16 ++-- nano/node/epoch_upgrader.hpp | 4 +- nano/node/gap_cache.cpp | 2 +- nano/node/ipc/ipc_broker.cpp | 12 +-- nano/node/ipc/ipc_server.cpp | 34 +++---- nano/node/json_handler.cpp | 4 +- nano/node/make_store.cpp | 2 +- nano/node/make_store.hpp | 2 +- nano/node/network.cpp | 10 +- nano/node/node.cpp | 94 +++++++++--------- nano/node/node.hpp | 2 +- nano/node/openclwork.cpp | 54 +++++------ nano/node/openclwork.hpp | 8 +- nano/node/portmapping.cpp | 24 ++--- nano/node/repcrawler.cpp | 8 +- nano/node/transport/socket.cpp | 4 +- nano/node/transport/tcp.cpp | 18 ++-- nano/node/transport/tcp_server.cpp | 42 ++++---- nano/node/vote_processor.cpp | 8 +- nano/node/vote_processor.hpp | 6 +- nano/node/wallet.cpp | 26 ++--- nano/node/websocket.cpp | 66 ++++++------- nano/node/websocket.hpp | 22 ++--- nano/qt/qt.cpp | 4 +- nano/qt_test/entry.cpp | 2 +- nano/qt_test/qt.cpp | 8 +- nano/rpc/rpc.cpp | 8 +- nano/rpc/rpc.hpp | 2 +- nano/rpc/rpc_connection.cpp | 12 +-- nano/rpc/rpc_connection.hpp | 4 +- nano/rpc/rpc_handler.cpp | 6 +- nano/rpc/rpc_handler.hpp | 4 +- nano/rpc/rpc_secure.cpp | 4 +- nano/rpc_test/entry.cpp | 2 +- nano/secure/ledger.cpp | 4 +- nano/slow_test/entry.cpp | 2 +- nano/slow_test/node.cpp | 6 +- nano/store/lmdb/lmdb.cpp | 34 +++---- nano/store/lmdb/lmdb.hpp | 6 +- nano/store/lmdb/transaction.cpp | 6 +- nano/store/lmdb/transaction_impl.hpp | 4 +- nano/store/rocksdb/rocksdb.cpp | 20 ++-- nano/store/rocksdb/rocksdb.hpp | 4 +- nano/test_common/ledger.cpp | 2 +- nano/test_common/ledger.hpp | 2 +- nano/test_common/system.hpp | 2 +- 80 files changed, 544 insertions(+), 544 deletions(-) diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index fa2bd3286b..fe6d90c40c 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -27,7 +27,7 @@ using namespace std::chrono_literals; TEST (block_store, construction) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); } @@ -102,7 +102,7 @@ TEST (block_store, sideband_serialization) TEST (block_store, add_item) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -133,7 +133,7 @@ TEST (block_store, add_item) TEST (block_store, clear_successor) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -180,7 +180,7 @@ TEST (block_store, clear_successor) TEST (block_store, add_nonempty_block) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::keypair key1; @@ -207,7 +207,7 @@ TEST (block_store, add_nonempty_block) TEST (block_store, add_two_items) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::keypair key1; @@ -253,7 +253,7 @@ TEST (block_store, add_two_items) TEST (block_store, add_receive) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::keypair key1; @@ -289,7 +289,7 @@ TEST (block_store, add_receive) TEST (block_store, add_pending) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::keypair key1; @@ -307,7 +307,7 @@ TEST (block_store, add_pending) TEST (block_store, pending_iterator) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); auto transaction (store->tx_begin_write ()); @@ -332,7 +332,7 @@ TEST (block_store, pending_iterator) */ TEST (block_store, pending_iterator_comparison) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -375,7 +375,7 @@ TEST (block_store, pending_iterator_comparison) TEST (block_store, genesis) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::ledger_cache ledger_cache; @@ -403,7 +403,7 @@ TEST (block_store, genesis) TEST (block_store, empty_accounts) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); auto transaction (store->tx_begin_read ()); @@ -414,7 +414,7 @@ TEST (block_store, empty_accounts) TEST (block_store, one_block) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -435,7 +435,7 @@ TEST (block_store, one_block) TEST (block_store, empty_bootstrap) { nano::test::system system{}; - nano::nlogger logger; + nano::logger logger; nano::unchecked_map unchecked{ system.stats, false }; size_t count = 0; unchecked.for_each ([&count] (nano::unchecked_key const & key, nano::unchecked_info const & info) { @@ -446,7 +446,7 @@ TEST (block_store, empty_bootstrap) TEST (block_store, unchecked_begin_search) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::keypair key0; @@ -471,7 +471,7 @@ TEST (block_store, unchecked_begin_search) TEST (block_store, frontier_retrieval) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::account account1{}; @@ -486,7 +486,7 @@ TEST (block_store, frontier_retrieval) TEST (block_store, one_account) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::account account{}; @@ -513,7 +513,7 @@ TEST (block_store, one_account) TEST (block_store, two_block) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -551,7 +551,7 @@ TEST (block_store, two_block) TEST (block_store, two_account) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::account account1 (1); @@ -593,7 +593,7 @@ TEST (block_store, two_account) TEST (block_store, latest_find) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::account account1 (1); @@ -627,7 +627,7 @@ TEST (mdb_block_store, supported_version_upgrades) } // Check that upgrading from an unsupported version is not supported auto path (nano::unique_path () / "data.ldb"); - nano::nlogger logger; + nano::logger logger; { nano::store::lmdb::component store (logger, path, nano::dev::constants); nano::stats stats; @@ -671,7 +671,7 @@ TEST (mdb_block_store, bad_path) // Don't test this in rocksdb mode GTEST_SKIP (); } - nano::nlogger logger; + nano::logger logger; try { auto path = nano::unique_path (); @@ -697,14 +697,14 @@ TEST (block_store, DISABLED_already_open) // File can be shared std::ofstream file; file.open (path.string ().c_str ()); ASSERT_TRUE (file.is_open ()); - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (store->init_error ()); } TEST (block_store, roots) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -746,7 +746,7 @@ TEST (block_store, roots) TEST (block_store, pending_exists) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::pending_key two (2, 0); @@ -759,7 +759,7 @@ TEST (block_store, pending_exists) TEST (block_store, latest_exists) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::account two (2); @@ -773,7 +773,7 @@ TEST (block_store, latest_exists) TEST (block_store, large_iteration) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); std::unordered_set accounts1; @@ -812,7 +812,7 @@ TEST (block_store, large_iteration) TEST (block_store, frontier) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); auto transaction (store->tx_begin_write ()); @@ -827,7 +827,7 @@ TEST (block_store, frontier) TEST (block_store, block_replace) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -859,7 +859,7 @@ TEST (block_store, block_replace) TEST (block_store, block_count) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); { @@ -884,7 +884,7 @@ TEST (block_store, block_count) TEST (block_store, account_count) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); { @@ -900,7 +900,7 @@ TEST (block_store, account_count) TEST (block_store, cemented_count_cache) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); auto transaction (store->tx_begin_write ()); @@ -911,7 +911,7 @@ TEST (block_store, cemented_count_cache) TEST (block_store, block_random) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); { nano::ledger_cache ledger_cache; @@ -926,7 +926,7 @@ TEST (block_store, block_random) TEST (block_store, pruned_random) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; @@ -953,7 +953,7 @@ TEST (block_store, pruned_random) TEST (block_store, state_block) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); nano::keypair key1; @@ -1000,7 +1000,7 @@ TEST (mdb_block_store, sideband_height) // Don't test this in rocksdb mode GTEST_SKIP (); } - nano::nlogger logger; + nano::logger logger; nano::keypair key1; nano::keypair key2; nano::keypair key3; @@ -1153,7 +1153,7 @@ TEST (mdb_block_store, sideband_height) TEST (block_store, peers) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -1251,7 +1251,7 @@ TEST (block_store, endpoint_key_byte_order) TEST (block_store, online_weight) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); { @@ -1286,7 +1286,7 @@ TEST (block_store, online_weight) TEST (block_store, pruned_blocks) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -1373,7 +1373,7 @@ TEST (mdb_block_store, upgrade_v21_v22) } auto path (nano::unique_path () / "data.ldb"); - nano::nlogger logger; + nano::logger logger; nano::stats stats; auto const check_correct_state = [&] () { nano::store::lmdb::component store (logger, path, nano::dev::constants); @@ -1412,7 +1412,7 @@ TEST (rocksdb_block_store, upgrade_v21_v22) } auto const path = nano::unique_path () / "rocksdb"; - nano::nlogger logger; + nano::logger logger; nano::stats stats; auto const check_correct_state = [&] () { nano::store::rocksdb::component store (logger, path, nano::dev::constants); @@ -1472,7 +1472,7 @@ TEST (mdb_block_store, upgrade_backup) }; { - nano::nlogger logger; + nano::logger logger; nano::store::lmdb::component store (logger, path, nano::dev::constants); auto transaction (store.tx_begin_write ()); store.version.put (transaction, store.version_minimum); @@ -1480,7 +1480,7 @@ TEST (mdb_block_store, upgrade_backup) ASSERT_EQ (get_backup_path ().string (), dir.string ()); // Now do the upgrade and confirm that backup is saved - nano::nlogger logger; + nano::logger logger; nano::store::lmdb::component store (logger, path, nano::dev::constants, nano::txn_tracking_config{}, std::chrono::seconds (5), nano::lmdb_config{}, true); ASSERT_FALSE (store.init_error ()); auto transaction (store.tx_begin_read ()); @@ -1497,7 +1497,7 @@ TEST (block_store, confirmation_height) GTEST_SKIP (); } auto path (nano::unique_path ()); - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, path, nano::dev::constants); nano::account account1{}; @@ -1543,7 +1543,7 @@ TEST (block_store, final_vote) GTEST_SKIP (); } auto path (nano::unique_path ()); - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, path, nano::dev::constants); { @@ -1568,7 +1568,7 @@ TEST (block_store, final_vote) TEST (block_store, incompatible_version) { auto path (nano::unique_path ()); - nano::nlogger logger; + nano::logger logger; { auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_FALSE (store->init_error ()); @@ -1591,7 +1591,7 @@ TEST (block_store, incompatible_version) TEST (block_store, reset_renew_existing_transaction) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -1631,7 +1631,7 @@ TEST (block_store, reset_renew_existing_transaction) TEST (block_store, rocksdb_force_test_env_variable) { - nano::nlogger logger; + nano::logger logger; // Set environment variable constexpr auto env_var = "TEST_USE_ROCKSDB"; @@ -1661,7 +1661,7 @@ TEST (rocksdb_block_store, tombstone_count) GTEST_SKIP (); } nano::test::system system; - nano::nlogger logger; + nano::logger logger; auto store = std::make_unique (logger, nano::unique_path () / "rocksdb", nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::block_builder builder; diff --git a/nano/core_test/bootstrap_ascending.cpp b/nano/core_test/bootstrap_ascending.cpp index 7599ed5c5f..49b8ed299d 100644 --- a/nano/core_test/bootstrap_ascending.cpp +++ b/nano/core_test/bootstrap_ascending.cpp @@ -25,7 +25,7 @@ nano::block_hash random_hash () TEST (account_sets, construction) { nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -35,7 +35,7 @@ TEST (account_sets, empty_blocked) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -46,7 +46,7 @@ TEST (account_sets, block) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -58,7 +58,7 @@ TEST (account_sets, unblock) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -72,7 +72,7 @@ TEST (account_sets, priority_base) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -83,7 +83,7 @@ TEST (account_sets, priority_blocked) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -96,7 +96,7 @@ TEST (account_sets, priority_unblock_keep) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -114,7 +114,7 @@ TEST (account_sets, priority_up_down) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -129,7 +129,7 @@ TEST (account_sets, priority_down_sat) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; @@ -142,7 +142,7 @@ TEST (account_sets, saturate_priority) { nano::account account{ 1 }; nano::stats stats; - nano::nlogger logger; + nano::logger 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 }; diff --git a/nano/core_test/confirmation_height.cpp b/nano/core_test/confirmation_height.cpp index aaba8735fa..2271e4985c 100644 --- a/nano/core_test/confirmation_height.cpp +++ b/nano/core_test/confirmation_height.cpp @@ -1158,7 +1158,7 @@ TEST (confirmation_heightDeathTest, rollback_added_block) // valgrind can be noisy with death tests if (!nano::running_within_valgrind ()) { - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -1249,7 +1249,7 @@ TEST (confirmation_heightDeathTest, modified_chain) // valgrind can be noisy with death tests if (!nano::running_within_valgrind ()) { - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -1326,7 +1326,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed) // valgrind can be noisy with death tests if (!nano::running_within_valgrind ()) { - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -2037,7 +2037,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration) // Don't test this in rocksdb mode GTEST_SKIP (); } - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); @@ -2100,7 +2100,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration) TEST (confirmation_height, pruned_source) { - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); diff --git a/nano/core_test/core_test_main.cc b/nano/core_test/core_test_main.cc index f165199a83..0abd1cdc3a 100644 --- a/nano/core_test/core_test_main.cc +++ b/nano/core_test/core_test_main.cc @@ -19,7 +19,7 @@ void force_nano_dev_network (); GTEST_API_ int main (int argc, char ** argv) { - nano::nlogger::initialize_for_tests (nano::log_config::tests_default ()); + nano::logger::initialize_for_tests (nano::log_config::tests_default ()); 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; diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index 70841d5eee..efe7a05ab0 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -818,7 +818,7 @@ TEST (ledger, representation) TEST (ledger, double_open) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -4162,7 +4162,7 @@ TEST (ledger, block_hash_account_conflict) TEST (ledger, could_fit) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -4800,7 +4800,7 @@ TEST (ledger, dependents_confirmed) TEST (ledger, dependents_confirmed_pruning) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); nano::stats stats; @@ -4990,7 +4990,7 @@ TEST (ledger, cache) TEST (ledger, pruning_action) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5074,7 +5074,7 @@ TEST (ledger, pruning_action) TEST (ledger, pruning_large_chain) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5129,7 +5129,7 @@ TEST (ledger, pruning_large_chain) TEST (ledger, pruning_source_rollback) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5217,7 +5217,7 @@ TEST (ledger, pruning_source_rollback) TEST (ledger, pruning_source_rollback_legacy) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5330,7 +5330,7 @@ TEST (ledger, pruning_source_rollback_legacy) TEST (ledger, pruning_process_error) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5377,7 +5377,7 @@ TEST (ledger, pruning_process_error) TEST (ledger, pruning_legacy_blocks) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5463,7 +5463,7 @@ TEST (ledger, pruning_legacy_blocks) TEST (ledger, pruning_safe_functions) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5524,7 +5524,7 @@ TEST (ledger, pruning_safe_functions) TEST (ledger, hash_root_random) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::stats stats; @@ -5588,7 +5588,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb) { nano::test::system system{}; auto path = nano::unique_path (); - nano::nlogger logger; + nano::logger 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 }; diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index c6f8861c1d..127ba46f90 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -3296,7 +3296,7 @@ TEST (node, dont_write_lock_node) std::promise write_lock_held_promise; std::promise finished_promise; std::thread ([&path, &write_lock_held_promise, &finished_promise] () { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, path, nano::dev::constants, false, true); { nano::ledger_cache ledger_cache; diff --git a/nano/core_test/processor_service.cpp b/nano/core_test/processor_service.cpp index 6e48598762..406e2ed47d 100644 --- a/nano/core_test/processor_service.cpp +++ b/nano/core_test/processor_service.cpp @@ -11,7 +11,7 @@ TEST (processor_service, bad_send_signature) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); nano::stats stats; @@ -37,7 +37,7 @@ TEST (processor_service, bad_send_signature) TEST (processor_service, bad_receive_signature) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); nano::stats stats; diff --git a/nano/core_test/work_pool.cpp b/nano/core_test/work_pool.cpp index 1c429ca3a9..59ada8938c 100644 --- a/nano/core_test/work_pool.cpp +++ b/nano/core_test/work_pool.cpp @@ -89,7 +89,7 @@ TEST (work, cancel_many) TEST (work, opencl) { - nano::nlogger logger; + nano::logger logger; bool error (false); nano::opencl_environment environment (error); ASSERT_TRUE (!error || !nano::opencl_loaded); diff --git a/nano/lib/logging.cpp b/nano/lib/logging.cpp index 8f491850b0..f24c2e8ed8 100644 --- a/nano/lib/logging.cpp +++ b/nano/lib/logging.cpp @@ -15,26 +15,26 @@ namespace std::atomic logging_initialized{ false }; } -nano::nlogger & nano::default_logger () +nano::logger & nano::default_logger () { - static nano::nlogger logger{ "default" }; + static nano::logger logger{ "default" }; return logger; } /* - * nlogger + * logger */ -bool nano::nlogger::global_initialized{ false }; -nano::log_config nano::nlogger::global_config{}; -std::vector nano::nlogger::global_sinks{}; +bool nano::logger::global_initialized{ false }; +nano::log_config nano::logger::global_config{}; +std::vector nano::logger::global_sinks{}; // By default, use only the tag as the logger name, since only one node is running in the process -std::function nano::nlogger::global_name_formatter{ [] (auto tag, auto identifier) { +std::function nano::logger::global_name_formatter{ [] (auto tag, auto identifier) { return std::string{ to_string (tag) }; } }; -void nano::nlogger::initialize (nano::log_config fallback, std::filesystem::path data_path, std::vector const & config_overrides) +void nano::logger::initialize (nano::log_config fallback, std::filesystem::path data_path, std::vector const & config_overrides) { auto config = nano::load_log_config (std::move (fallback), data_path, config_overrides); initialize_common (config, data_path); @@ -95,7 +95,7 @@ class tag_formatter_flag : public spdlog::custom_flag_formatter }; } -void nano::nlogger::initialize_for_tests (nano::log_config fallback) +void nano::logger::initialize_for_tests (nano::log_config fallback) { auto config = nano::load_log_config (std::move (fallback), /* load log config from current workdir */ {}); initialize_common (config, /* store log file in current workdir */ {}); @@ -119,7 +119,7 @@ void nano::nlogger::initialize_for_tests (nano::log_config fallback) global_initialized = true; } -void nano::nlogger::initialize_common (nano::log_config const & config, std::filesystem::path data_path) +void nano::logger::initialize_common (nano::log_config const & config, std::filesystem::path data_path) { global_config = config; @@ -183,7 +183,7 @@ void nano::nlogger::initialize_common (nano::log_config const & config, std::fil } } -void nano::nlogger::flush () +void nano::logger::flush () { for (auto & sink : global_sinks) { @@ -192,15 +192,15 @@ void nano::nlogger::flush () } /* - * nlogger + * logger */ -nano::nlogger::nlogger (std::string identifier) : +nano::logger::logger (std::string identifier) : identifier{ std::move (identifier) } { } -spdlog::logger & nano::nlogger::get_logger (nano::log::type tag) +spdlog::logger & nano::logger::get_logger (nano::log::type tag) { // This is a two-step process to avoid exclusively locking the mutex in the common case { @@ -220,7 +220,7 @@ spdlog::logger & nano::nlogger::get_logger (nano::log::type tag) } } -std::shared_ptr nano::nlogger::make_logger (nano::log::type tag) +std::shared_ptr nano::logger::make_logger (nano::log::type tag) { auto const & config = global_config; auto const & sinks = global_sinks; diff --git a/nano/lib/logging.hpp b/nano/lib/logging.hpp index 1c23d49ba2..4844cda40b 100644 --- a/nano/lib/logging.hpp +++ b/nano/lib/logging.hpp @@ -67,13 +67,13 @@ namespace nano { spdlog::level::level_enum to_spdlog_level (nano::log::level); -class nlogger final +class logger final { public: - nlogger (std::string identifier = ""); + logger (std::string identifier = ""); // Disallow copies - nlogger (nlogger const &) = delete; + logger (logger const &) = delete; public: static void initialize (nano::log_config fallback, std::filesystem::path data_path = {}, std::vector const & config_overrides = std::vector ()); @@ -136,5 +136,5 @@ class nlogger final std::shared_ptr make_logger (nano::log::type tag); }; -nano::nlogger & default_logger (); +nano::logger & default_logger (); } \ No newline at end of file diff --git a/nano/lib/tlsconfig.cpp b/nano/lib/tlsconfig.cpp index 898103763b..9af33384b4 100644 --- a/nano/lib/tlsconfig.cpp +++ b/nano/lib/tlsconfig.cpp @@ -138,7 +138,7 @@ namespace } #endif -nano::error read_tls_config_toml (std::filesystem::path const & data_path_a, nano::tls_config & config_a, nano::nlogger & nlogger, std::vector const & config_overrides) +nano::error read_tls_config_toml (std::filesystem::path const & data_path_a, nano::tls_config & config_a, nano::logger & logger, std::vector const & config_overrides) { nano::error error; auto toml_config_path = nano::get_tls_toml_config_path (data_path_a); @@ -176,7 +176,7 @@ nano::error read_tls_config_toml (std::filesystem::path const & data_path_a, nan #ifdef NANO_SECURE_RPC load_certs (config_a, logger_a); #else - nlogger.critical (nano::log::type::tls, "HTTPS or WSS is enabled in the TLS configuration, but the node is not built with NANO_SECURE_RPC"); + logger.critical (nano::log::type::tls, "HTTPS or WSS is enabled in the TLS configuration, but the node is not built with NANO_SECURE_RPC"); std::exit (1); #endif } diff --git a/nano/lib/tlsconfig.hpp b/nano/lib/tlsconfig.hpp index d7d18f4202..bae2a9f9b2 100644 --- a/nano/lib/tlsconfig.hpp +++ b/nano/lib/tlsconfig.hpp @@ -13,7 +13,7 @@ namespace nano { -class nlogger; +class logger; class jsonconfig; class tomlconfig; @@ -54,5 +54,5 @@ class tls_config final #endif }; -nano::error read_tls_config_toml (std::filesystem::path const & data_path_a, nano::tls_config & config_a, nano::nlogger &, std::vector const & config_overrides = std::vector ()); +nano::error read_tls_config_toml (std::filesystem::path const & data_path_a, nano::tls_config & config_a, nano::logger &, std::vector const & config_overrides = std::vector ()); } diff --git a/nano/load_test/entry.cpp b/nano/load_test/entry.cpp index a159d05cd8..e41e376abc 100644 --- a/nano/load_test/entry.cpp +++ b/nano/load_test/entry.cpp @@ -491,7 +491,7 @@ account_info account_info_rpc (boost::asio::io_context & ioc, tcp::resolver::res /** This launches a node and fires a lot of send/recieve RPC requests at it (configurable), then other nodes are tested to make sure they observe these blocks as well. */ int main (int argc, char * const * argv) { - nano::nlogger::initialize_for_tests (nano::log_config::tests_default ()); + nano::logger::initialize_for_tests (nano::log_config::tests_default ()); nano::force_nano_dev_network (); boost::program_options::options_description description ("Command line options"); diff --git a/nano/nano_node/daemon.cpp b/nano/nano_node/daemon.cpp index 728cd5ad0d..fed22d3bcf 100644 --- a/nano/nano_node/daemon.cpp +++ b/nano/nano_node/daemon.cpp @@ -63,9 +63,9 @@ constexpr std::size_t OPEN_FILE_DESCRIPTORS_LIMIT = 16384; void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flags const & flags) { - nano::nlogger::initialize (nano::log_config::daemon_default (), data_path, flags.config_overrides); + nano::logger::initialize (nano::log_config::daemon_default (), data_path, flags.config_overrides); - nlogger.info (nano::log::type::daemon, "Daemon started"); + logger.info (nano::log::type::daemon, "Daemon started"); install_abort_signal_handler (); @@ -87,7 +87,7 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag if (!error) { auto tls_config (std::make_shared ()); - error = nano::read_tls_config_toml (data_path, *tls_config, nlogger); + error = nano::read_tls_config_toml (data_path, *tls_config, logger); if (error) { std::cerr << error.get_message () << std::endl; @@ -99,7 +99,7 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag } boost::asio::io_context io_ctx; - auto opencl (nano::opencl_work::create (config.opencl_enable, config.opencl, nlogger, config.node.network_params.work)); + auto opencl (nano::opencl_work::create (config.opencl_enable, config.opencl, logger, config.node.network_params.work)); nano::work_pool opencl_work (config.node.network_params.network, config.node.work_threads, config.node.pow_sleep_interval, opencl ? [&opencl] (nano::work_version const version_a, nano::root const & root_a, uint64_t difficulty_a, std::atomic & ticket_a) { return opencl->generate_work (version_a, root_a, difficulty_a, ticket_a); } @@ -107,17 +107,17 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag try { // This avoids a blank prompt during any node initialization delays - nlogger.info (nano::log::type::daemon, "Starting up Nano node..."); + logger.info (nano::log::type::daemon, "Starting up Nano node..."); // Print info about number of logical cores detected, those are used to decide how many IO, worker and signature checker threads to spawn - nlogger.info (nano::log::type::daemon, "Hardware concurrency: {} ( configured: {} )", std::thread::hardware_concurrency (), nano::hardware_concurrency ()); + logger.info (nano::log::type::daemon, "Hardware concurrency: {} ( configured: {} )", std::thread::hardware_concurrency (), nano::hardware_concurrency ()); nano::set_file_descriptor_limit (OPEN_FILE_DESCRIPTORS_LIMIT); auto const file_descriptor_limit = nano::get_file_descriptor_limit (); - nlogger.info (nano::log::type::daemon, "File descriptors limit: {}", file_descriptor_limit); + logger.info (nano::log::type::daemon, "File descriptors limit: {}", file_descriptor_limit); if (file_descriptor_limit < OPEN_FILE_DESCRIPTORS_LIMIT) { - nlogger.warn (nano::log::type::daemon, "File descriptors limit is lower than the {} recommended. Node was unable to change it.", OPEN_FILE_DESCRIPTORS_LIMIT); + logger.warn (nano::log::type::daemon, "File descriptors limit is lower than the {} recommended. Node was unable to change it.", OPEN_FILE_DESCRIPTORS_LIMIT); } // for the daemon start up, if the user hasn't specified a port in @@ -134,12 +134,12 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag auto network_label = node->network_params.network.get_current_network_as_string (); std::time_t dateTime = std::time (nullptr); - nlogger.info (nano::log::type::daemon, "Network: {}", network_label); - nlogger.info (nano::log::type::daemon, "Version: {}", NANO_VERSION_STRING); - nlogger.info (nano::log::type::daemon, "Data path: '{}'", node->application_path.string ()); - nlogger.info (nano::log::type::daemon, "Build info: {}", BUILD_INFO); - nlogger.info (nano::log::type::daemon, "Database backend: {}", node->store.vendor_get ()); - nlogger.info (nano::log::type::daemon, "Start time: {:%c} UTC", fmt::gmtime (dateTime)); + logger.info (nano::log::type::daemon, "Network: {}", network_label); + logger.info (nano::log::type::daemon, "Version: {}", NANO_VERSION_STRING); + logger.info (nano::log::type::daemon, "Data path: '{}'", node->application_path.string ()); + logger.info (nano::log::type::daemon, "Build info: {}", BUILD_INFO); + logger.info (nano::log::type::daemon, "Database backend: {}", node->store.vendor_get ()); + logger.info (nano::log::type::daemon, "Start time: {:%c} UTC", fmt::gmtime (dateTime)); node->start (); @@ -186,7 +186,7 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag debug_assert (!nano::signal_handler_impl); nano::signal_handler_impl = [this, &io_ctx] () { - nlogger.warn (nano::log::type::daemon, "Interrupt signal received, stopping..."); + logger.warn (nano::log::type::daemon, "Interrupt signal received, stopping..."); io_ctx.stop (); sig_int_or_term = 1; @@ -219,18 +219,18 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag } else { - nlogger.critical (nano::log::type::daemon, "Error initializing node"); + logger.critical (nano::log::type::daemon, "Error initializing node"); } } catch (std::runtime_error const & e) { - nlogger.critical (nano::log::type::daemon, "Error while running node: {}", e.what ()); + logger.critical (nano::log::type::daemon, "Error while running node: {}", e.what ()); } } else { - nlogger.critical (nano::log::type::daemon, "Error deserializing config: {}", error.get_message ()); + logger.critical (nano::log::type::daemon, "Error deserializing config: {}", error.get_message ()); } - nlogger.info (nano::log::type::daemon, "Daemon exiting"); + logger.info (nano::log::type::daemon, "Daemon exiting"); } diff --git a/nano/nano_node/daemon.hpp b/nano/nano_node/daemon.hpp index b3d365ce39..8fcc69787c 100644 --- a/nano/nano_node/daemon.hpp +++ b/nano/nano_node/daemon.hpp @@ -6,7 +6,7 @@ class node_flags; class daemon { - nano::nlogger nlogger{ "daemon" }; + nano::logger logger{ "daemon" }; public: void run (std::filesystem::path const &, nano::node_flags const & flags); diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index bee3d44e06..e77751762e 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -54,7 +54,7 @@ class address_library_pair int main (int argc, char * const * argv) { nano::set_umask (); // Make sure the process umask is set before any files are created - nano::nlogger::initialize (nano::log_config::cli_default ()); + nano::logger::initialize (nano::log_config::cli_default ()); nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard; @@ -613,9 +613,9 @@ int main (int argc, char * const * argv) error |= device >= environment.platforms[platform].devices.size (); if (!error) { - nano::nlogger nlogger; + nano::logger logger; nano::opencl_config config (platform, device, threads); - auto opencl (nano::opencl_work::create (true, config, nlogger, network_params.work)); + auto opencl (nano::opencl_work::create (true, config, logger, network_params.work)); nano::work_pool work_pool{ network_params.network, 0, std::chrono::nanoseconds (0), opencl ? [&opencl] (nano::work_version const version_a, nano::root const & root_a, uint64_t difficulty_a, std::atomic &) { return opencl->generate_work (version_a, root_a, difficulty_a); } @@ -1881,11 +1881,11 @@ int main (int argc, char * const * argv) else if (vm.count ("debug_sys_logging")) { auto inactive_node = nano::default_inactive_node (data_path, vm); - inactive_node->node->nlogger.critical ({}, "Testing system logger (CRITICAL)"); - inactive_node->node->nlogger.error ({}, "Testing system logger (ERROR)"); - inactive_node->node->nlogger.warn ({}, "Testing system logger (WARN)"); - inactive_node->node->nlogger.info ({}, "Testing system logger (INFO)"); - inactive_node->node->nlogger.debug ({}, "Testing system logger (DEBUG)"); + inactive_node->node->logger.critical ({}, "Testing system logger (CRITICAL)"); + inactive_node->node->logger.error ({}, "Testing system logger (ERROR)"); + inactive_node->node->logger.warn ({}, "Testing system logger (WARN)"); + inactive_node->node->logger.info ({}, "Testing system logger (INFO)"); + inactive_node->node->logger.debug ({}, "Testing system logger (DEBUG)"); } else if (vm.count ("debug_account_versions")) { diff --git a/nano/nano_rpc/entry.cpp b/nano/nano_rpc/entry.cpp index 1238c95ce3..65e1de81e9 100644 --- a/nano/nano_rpc/entry.cpp +++ b/nano/nano_rpc/entry.cpp @@ -19,11 +19,11 @@ namespace { volatile sig_atomic_t sig_int_or_term = 0; -nano::nlogger nlogger{ "rpc_daemon" }; +nano::logger logger{ "rpc_daemon" }; void run (std::filesystem::path const & data_path, std::vector const & config_overrides) { - nlogger.info (nano::log::type::daemon_rpc, "Daemon started (RPC)"); + logger.info (nano::log::type::daemon_rpc, "Daemon started (RPC)"); std::filesystem::create_directories (data_path); @@ -38,10 +38,10 @@ void run (std::filesystem::path const & data_path, std::vector cons if (!error) { auto tls_config (std::make_shared ()); - error = nano::read_tls_config_toml (data_path, *tls_config, nlogger); + error = nano::read_tls_config_toml (data_path, *tls_config, logger); if (error) { - nlogger.critical (nano::log::type::daemon, "Error reading RPC TLS config: {}", error.get_message ()); + logger.critical (nano::log::type::daemon, "Error reading RPC TLS config: {}", error.get_message ()); std::exit (1); } else @@ -76,22 +76,22 @@ void run (std::filesystem::path const & data_path, std::vector cons } catch (std::runtime_error const & e) { - nlogger.critical (nano::log::type::daemon, "Error while running RPC: {}", e.what ()); + logger.critical (nano::log::type::daemon, "Error while running RPC: {}", e.what ()); } } else { - nlogger.critical (nano::log::type::daemon, "Error deserializing config: {}", error.get_message ()); + logger.critical (nano::log::type::daemon, "Error deserializing config: {}", error.get_message ()); } - nlogger.info (nano::log::type::daemon_rpc, "Daemon stopped (RPC)"); + logger.info (nano::log::type::daemon_rpc, "Daemon stopped (RPC)"); } } int main (int argc, char * const * argv) { nano::set_umask (); // Make sure the process umask is set before any files are created - nano::nlogger::initialize (nano::log_config::cli_default ()); + nano::logger::initialize (nano::log_config::cli_default ()); boost::program_options::options_description description ("Command line options"); diff --git a/nano/nano_wallet/entry.cpp b/nano/nano_wallet/entry.cpp index 3c863c06f1..ec15e6fb98 100644 --- a/nano/nano_wallet/entry.cpp +++ b/nano/nano_wallet/entry.cpp @@ -26,11 +26,11 @@ namespace { -nano::nlogger nlogger{ "wallet_daemon" }; +nano::logger logger{ "wallet_daemon" }; void show_error (std::string const & message_a) { - nlogger.critical (nano::log::type::daemon, "{}", message_a); + logger.critical (nano::log::type::daemon, "{}", message_a); QMessageBox message (QMessageBox::Critical, "Error starting Nano", message_a.c_str ()); message.setModal (true); @@ -74,9 +74,9 @@ nano::error read_wallet_config (nano::wallet_config & config_a, std::filesystem: int run_wallet (QApplication & application, int argc, char * const * argv, std::filesystem::path const & data_path, nano::node_flags const & flags) { - nano::nlogger::initialize (nano::log_config::daemon_default (), data_path, flags.config_overrides); + nano::logger::initialize (nano::log_config::daemon_default (), data_path, flags.config_overrides); - nlogger.info (nano::log::type::daemon_wallet, "Daemon started (wallet)"); + logger.info (nano::log::type::daemon_wallet, "Daemon started (wallet)"); int result (0); nano_qt::eventloop_processor processor; @@ -110,7 +110,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std:: nano::set_use_memory_pools (config.node.use_memory_pools); auto tls_config (std::make_shared ()); - error = nano::read_tls_config_toml (data_path, *tls_config, nlogger); + error = nano::read_tls_config_toml (data_path, *tls_config, logger); if (error) { splash->hide (); @@ -128,7 +128,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std:: std::shared_ptr node; std::shared_ptr gui; nano::set_application_icon (application); - auto opencl (nano::opencl_work::create (config.opencl_enable, config.opencl, nlogger, config.node.network_params.work)); + auto opencl (nano::opencl_work::create (config.opencl_enable, config.opencl, logger, config.node.network_params.work)); nano::work_pool work{ config.node.network_params.network, config.node.work_threads, config.node.pow_sleep_interval, opencl ? [&opencl] (nano::work_version const version_a, nano::root const & root_a, uint64_t difficulty_a, std::atomic &) { return opencl->generate_work (version_a, root_a, difficulty_a); } @@ -239,7 +239,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std:: show_error ("Error deserializing config: " + error.get_message ()); } - nlogger.info (nano::log::type::daemon_wallet, "Daemon exiting (wallet)"); + logger.info (nano::log::type::daemon_wallet, "Daemon exiting (wallet)"); return result; } @@ -247,7 +247,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std:: int main (int argc, char * const * argv) { nano::set_umask (); // Make sure the process umask is set before any files are created - nano::nlogger::initialize (nano::log_config::cli_default ()); + nano::logger::initialize (nano::log_config::cli_default ()); nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard; diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index f5667628ff..e696b5966b 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -112,17 +112,17 @@ void nano::block_processor::rollback_competitor (store::write_transaction const if (successor != nullptr && successor->hash () != hash) { // Replace our block with the winner and roll back any dependent blocks - node.nlogger.debug (nano::log::type::blockprocessor, "Rolling back: {} and replacing with: {}", successor->hash ().to_string (), hash.to_string ()); + node.logger.debug (nano::log::type::blockprocessor, "Rolling back: {} and replacing with: {}", successor->hash ().to_string (), hash.to_string ()); std::vector> rollback_list; if (node.ledger.rollback (transaction, successor->hash (), rollback_list)) { node.stats.inc (nano::stat::type::ledger, nano::stat::detail::rollback_failed); - node.nlogger.error (nano::log::type::blockprocessor, "Failed to roll back: {} because it or a successor was confirmed", successor->hash ().to_string ()); + node.logger.error (nano::log::type::blockprocessor, "Failed to roll back: {} because it or a successor was confirmed", successor->hash ().to_string ()); } else { - node.nlogger.debug (nano::log::type::blockprocessor, "Blocks rolled back: {}", rollback_list.size ()); + node.logger.debug (nano::log::type::blockprocessor, "Blocks rolled back: {}", rollback_list.size ()); } // Deleting from votes cache, stop active transaction for (auto & i : rollback_list) @@ -219,7 +219,7 @@ auto nano::block_processor::process_batch (nano::unique_lock & lock // TODO: Cleaner periodical logging if ((blocks.size () + forced.size () > 64) && should_log ()) { - node.nlogger.debug (nano::log::type::blockprocessor, "{} blocks (+ {} forced) in processing queue", blocks.size (), forced.size ()); + node.logger.debug (nano::log::type::blockprocessor, "{} blocks (+ {} forced) in processing queue", blocks.size (), forced.size ()); } std::shared_ptr block; @@ -253,7 +253,7 @@ auto nano::block_processor::process_batch (nano::unique_lock & lock if (number_of_blocks_processed != 0 && timer_l.stop () > std::chrono::milliseconds (100)) { - node.nlogger.debug (nano::log::type::blockprocessor, "Processed {} blocks ({} forced) in {} {}", number_of_blocks_processed, number_of_forced_processed, timer_l.value ().count (), timer_l.unit ()); + node.logger.debug (nano::log::type::blockprocessor, "Processed {} blocks ({} forced) in {} {}", number_of_blocks_processed, number_of_forced_processed, timer_l.value ().count (), timer_l.unit ()); } return processed; diff --git a/nano/node/bootstrap/bootstrap_attempt.cpp b/nano/node/bootstrap/bootstrap_attempt.cpp index 0502c943ae..8d892db2e2 100644 --- a/nano/node/bootstrap/bootstrap_attempt.cpp +++ b/nano/node/bootstrap/bootstrap_attempt.cpp @@ -20,7 +20,7 @@ nano::bootstrap_attempt::bootstrap_attempt (std::shared_ptr const & id = nano::hardened_constants::get ().random_128.to_string (); } - node_a->nlogger.debug (nano::log::type::bootstrap, "Starting bootstrap attempt with ID: {} (mode: {})", mode_text (), id); + node_a->logger.debug (nano::log::type::bootstrap, "Starting bootstrap attempt with ID: {} (mode: {})", mode_text (), id); node_a->bootstrap_initiator.notify_listeners (true); if (node_a->websocket.server) @@ -38,7 +38,7 @@ nano::bootstrap_attempt::~bootstrap_attempt () return; } - node->nlogger.debug (nano::log::type::bootstrap, "Exiting bootstrap attempt with ID: {} (mode: {})", mode_text (), id); + node->logger.debug (nano::log::type::bootstrap, "Exiting bootstrap attempt with ID: {} (mode: {})", mode_text (), id); node->bootstrap_initiator.notify_listeners (false); if (node->websocket.server) diff --git a/nano/node/bootstrap/bootstrap_bulk_pull.cpp b/nano/node/bootstrap/bootstrap_bulk_pull.cpp index 19538bbcd6..33fb6717a2 100644 --- a/nano/node/bootstrap/bootstrap_bulk_pull.cpp +++ b/nano/node/bootstrap/bootstrap_bulk_pull.cpp @@ -47,7 +47,7 @@ nano::bulk_pull_client::~bulk_pull_client () pull.processed += pull_blocks - unexpected_count; node->bootstrap_initiator.connections->requeue_pull (pull, network_error); - node->nlogger.debug (nano::log::type::bulk_pull_client, "Bulk pull end block is not expected {} for account {} or head block {}", pull.end.to_string (), pull.account_or_head.to_account (), pull.account_or_head.to_string ()); + node->logger.debug (nano::log::type::bulk_pull_client, "Bulk pull end block is not expected {} for account {} or head block {}", pull.end.to_string (), pull.account_or_head.to_account (), pull.account_or_head.to_string ()); } else { @@ -82,7 +82,7 @@ void nano::bulk_pull_client::request () if (attempt->should_log ()) { - node->nlogger.debug (nano::log::type::bulk_pull_client, "Accounts in pull queue: {}", attempt->pulling.load ()); + node->logger.debug (nano::log::type::bulk_pull_client, "Accounts in pull queue: {}", attempt->pulling.load ()); } auto this_l (shared_from_this ()); @@ -99,7 +99,7 @@ void nano::bulk_pull_client::request () } else { - node->nlogger.debug (nano::log::type::bulk_pull_client, "Error sending bulk pull request to: {} ({})", this_l->connection->channel->to_string (), ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_client, "Error sending bulk pull request to: {} ({})", this_l->connection->channel->to_string (), ec.message ()); node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_request_failure, nano::stat::dir::in); } }, @@ -160,7 +160,7 @@ void nano::bulk_pull_client::received_block (boost::system::error_code ec, std:: } if (node->network_params.work.validate_entry (*block)) { - node->nlogger.debug (nano::log::type::bulk_pull_client, "Insufficient work for bulk pull block: {}", block->hash ().to_string ()); + node->logger.debug (nano::log::type::bulk_pull_client, "Insufficient work for bulk pull block: {}", block->hash ().to_string ()); node->stats.inc (nano::stat::type::error, nano::stat::detail::insufficient_work); return; } @@ -234,7 +234,7 @@ void nano::bulk_pull_account_client::request () if (attempt->should_log ()) { - node->nlogger.debug (nano::log::type::bulk_pull_account_client, "Accounts in pull queue: {}", attempt->wallet_size ()); + node->logger.debug (nano::log::type::bulk_pull_account_client, "Accounts in pull queue: {}", attempt->wallet_size ()); } auto this_l (shared_from_this ()); @@ -251,7 +251,7 @@ void nano::bulk_pull_account_client::request () } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_client, "Error starting bulk pull request to: {} ({})", this_l->connection->channel->to_string (), ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_account_client, "Error starting bulk pull request to: {} ({})", this_l->connection->channel->to_string (), ec.message ()); node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_error_starting_request, nano::stat::dir::in); this_l->attempt->requeue_pending (this_l->account); @@ -314,14 +314,14 @@ void nano::bulk_pull_account_client::receive_pending () } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_client, "Error while receiving bulk pull account frontier: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_account_client, "Error while receiving bulk pull account frontier: {}", ec.message ()); this_l->attempt->requeue_pending (this_l->account); } } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_client, "Invalid size: Expected {}, got: {}", size_l, size_a); + node->logger.debug (nano::log::type::bulk_pull_account_client, "Invalid size: Expected {}, got: {}", size_l, size_a); this_l->attempt->requeue_pending (this_l->account); } @@ -355,14 +355,14 @@ void nano::bulk_pull_server::set_current_end () auto transaction (node->store.tx_begin_read ()); if (!node->store.block.exists (transaction, request->end)) { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Bulk pull end block doesn't exist: {}, sending everything", request->end.to_string ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Bulk pull end block doesn't exist: {}, sending everything", request->end.to_string ()); request->end.clear (); } if (node->store.block.exists (transaction, request->start.as_block_hash ())) { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Bulk pull request for block hash: {}", request->start.to_string ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Bulk pull request for block hash: {}", request->start.to_string ()); current = ascending () ? node->store.block.successor (transaction, request->start.as_block_hash ()) : request->start.as_block_hash (); include_start = true; @@ -372,7 +372,7 @@ void nano::bulk_pull_server::set_current_end () auto info = node->ledger.account_info (transaction, request->start.as_account ()); if (!info) { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Request for unknown account: {}", request->start.to_account ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Request for unknown account: {}", request->start.to_account ()); current = request->end; } @@ -384,7 +384,7 @@ void nano::bulk_pull_server::set_current_end () auto account (node->ledger.account (transaction, request->end)); if (account != request->start.as_account ()) { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Request for block that is not on account chain: {} not on {}", request->end.to_string (), request->start.to_account ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Request for block that is not on account chain: {} not on {}", request->end.to_string (), request->start.to_account ()); current = request->end; } @@ -520,7 +520,7 @@ void nano::bulk_pull_server::sent_action (boost::system::error_code const & ec, } else { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Unable to bulk send block: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Unable to bulk send block: {}", ec.message ()); } } @@ -534,7 +534,7 @@ void nano::bulk_pull_server::send_finished () nano::shared_const_buffer send_buffer (static_cast (nano::block_type::not_a_block)); auto this_l (shared_from_this ()); - node->nlogger.debug (nano::log::type::bulk_pull_server, "Bulk sending finished"); + node->logger.debug (nano::log::type::bulk_pull_server, "Bulk sending finished"); connection->socket->async_write (send_buffer, [this_l] (boost::system::error_code const & ec, std::size_t size_a) { this_l->no_block_sent (ec, size_a); @@ -555,7 +555,7 @@ void nano::bulk_pull_server::no_block_sent (boost::system::error_code const & ec } else { - node->nlogger.debug (nano::log::type::bulk_pull_server, "Unable to bulk send not-a-block: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_server, "Unable to bulk send not-a-block: {}", ec.message ()); } } @@ -607,7 +607,7 @@ void nano::bulk_pull_account_server::set_params () } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_server, "Invalid bulk_pull_account flags supplied: {}", static_cast (request->flags)); + node->logger.debug (nano::log::type::bulk_pull_account_server, "Invalid bulk_pull_account flags supplied: {}", static_cast (request->flags)); invalid_request = true; return; @@ -709,7 +709,7 @@ void nano::bulk_pull_account_server::send_next_block () /* * Otherwise, finalize the connection */ - node->nlogger.debug (nano::log::type::bulk_pull_account_server, "Done sending blocks"); + node->logger.debug (nano::log::type::bulk_pull_account_server, "Done sending blocks"); send_finished (); } @@ -814,7 +814,7 @@ void nano::bulk_pull_account_server::sent_action (boost::system::error_code cons } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_server, "Unable to bulk send block: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_account_server, "Unable to bulk send block: {}", ec.message ()); } } @@ -851,7 +851,7 @@ void nano::bulk_pull_account_server::send_finished () } } - node->nlogger.debug (nano::log::type::bulk_pull_account_server, "Bulk sending for an account finished"); + node->logger.debug (nano::log::type::bulk_pull_account_server, "Bulk sending for an account finished"); auto this_l (shared_from_this ()); connection->socket->async_write (nano::shared_const_buffer (std::move (send_buffer)), [this_l] (boost::system::error_code const & ec, std::size_t size_a) { @@ -888,7 +888,7 @@ void nano::bulk_pull_account_server::complete (boost::system::error_code const & } else { - node->nlogger.debug (nano::log::type::bulk_pull_account_server, "Unable to pending-as-zero: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_pull_account_server, "Unable to pending-as-zero: {}", ec.message ()); } } diff --git a/nano/node/bootstrap/bootstrap_bulk_push.cpp b/nano/node/bootstrap/bootstrap_bulk_push.cpp index 8dfeeeeb9a..5ff069ba12 100644 --- a/nano/node/bootstrap/bootstrap_bulk_push.cpp +++ b/nano/node/bootstrap/bootstrap_bulk_push.cpp @@ -38,7 +38,7 @@ void nano::bulk_push_client::start () } else { - node->nlogger.debug (nano::log::type::bulk_push_client, "Unable to send bulk push request: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_push_client, "Unable to send bulk push request: {}", ec.message ()); } }, nano::transport::buffer_drop_policy::no_limiter_drop); @@ -68,7 +68,7 @@ void nano::bulk_push_client::push () } else { - node->nlogger.debug (nano::log::type::bulk_push_client, "Bulk pushing range: [{}:{}]", current_target.first.to_string (), current_target.second.to_string ()); + node->logger.debug (nano::log::type::bulk_push_client, "Bulk pushing range: [{}:{}]", current_target.first.to_string (), current_target.second.to_string ()); } } } @@ -118,7 +118,7 @@ void nano::bulk_push_client::push_block (nano::block const & block_a) } else { - node->nlogger.debug (nano::log::type::bulk_push_client, "Error sending block during bulk push: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_push_client, "Error sending block during bulk push: {}", ec.message ()); } }); } @@ -162,7 +162,7 @@ void nano::bulk_push_server::receive () } if (node->bootstrap_initiator.in_progress ()) { - node->nlogger.debug (nano::log::type::bulk_push_server, "Aborting bulk push because a bootstrap attempt is in progress"); + node->logger.debug (nano::log::type::bulk_push_server, "Aborting bulk push because a bootstrap attempt is in progress"); } else { @@ -179,7 +179,7 @@ void nano::bulk_push_server::receive () } else { - node->nlogger.debug (nano::log::type::bulk_push_server, "Error receiving block type: {}", ec.message ()); + node->logger.debug (nano::log::type::bulk_push_server, "Error receiving block type: {}", ec.message ()); } }); } @@ -243,7 +243,7 @@ void nano::bulk_push_server::received_type () } default: { - node->nlogger.debug (nano::log::type::bulk_push_server, "Unknown type received as block type"); + node->logger.debug (nano::log::type::bulk_push_server, "Unknown type received as block type"); break; } } @@ -264,7 +264,7 @@ void nano::bulk_push_server::received_block (boost::system::error_code const & e { if (node->network_params.work.validate_entry (*block)) { - node->nlogger.debug (nano::log::type::bulk_push_server, "Insufficient work for bulk push block: {}", block->hash ().to_string ()); + node->logger.debug (nano::log::type::bulk_push_server, "Insufficient work for bulk push block: {}", block->hash ().to_string ()); node->stats.inc (nano::stat::type::error, nano::stat::detail::insufficient_work); return; } @@ -273,7 +273,7 @@ void nano::bulk_push_server::received_block (boost::system::error_code const & e } else { - node->nlogger.debug (nano::log::type::bulk_push_server, "Error deserializing block received from pull request"); + node->logger.debug (nano::log::type::bulk_push_server, "Error deserializing block received from pull request"); } } } diff --git a/nano/node/bootstrap/bootstrap_connections.cpp b/nano/node/bootstrap/bootstrap_connections.cpp index 8e2457c95f..ccb47c06a6 100644 --- a/nano/node/bootstrap/bootstrap_connections.cpp +++ b/nano/node/bootstrap/bootstrap_connections.cpp @@ -91,7 +91,7 @@ std::shared_ptr nano::bootstrap_connections::connection } if (result == nullptr && connections_count == 0 && new_connections_empty && attempt_a != nullptr) { - node.nlogger.debug (nano::log::type::bootstrap, "Bootstrap attempt stopped because there are no peers"); + node.logger.debug (nano::log::type::bootstrap, "Bootstrap attempt stopped because there are no peers"); lock.unlock (); attempt_a->stop (); @@ -158,7 +158,7 @@ void nano::bootstrap_connections::connect_client (nano::tcp_endpoint const & end [this_l, socket, endpoint_a, push_front] (boost::system::error_code const & ec) { if (!ec) { - this_l->node.nlogger.debug (nano::log::type::bootstrap, "Connection established to: {}", nano::util::to_str (endpoint_a)); + this_l->node.logger.debug (nano::log::type::bootstrap, "Connection established to: {}", nano::util::to_str (endpoint_a)); auto client (std::make_shared (this_l->node.shared (), std::make_shared (*this_l->node.shared (), socket), socket)); this_l->pool_connection (client, true, push_front); @@ -168,7 +168,7 @@ void nano::bootstrap_connections::connect_client (nano::tcp_endpoint const & end switch (ec.value ()) { default: - this_l->node.nlogger.debug (nano::log::type::bootstrap, "Error initiating bootstrap connection to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + this_l->node.logger.debug (nano::log::type::bootstrap, "Error initiating bootstrap connection to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); break; case boost::system::errc::connection_refused: case boost::system::errc::operation_canceled: @@ -232,7 +232,7 @@ void nano::bootstrap_connections::populate_connections (bool repeat) // This is ~1.5kilobits/sec. if (elapsed_sec > nano::bootstrap_limits::bootstrap_minimum_termination_time_sec && blocks_per_sec < nano::bootstrap_limits::bootstrap_minimum_blocks_per_sec) { - node.nlogger.debug (nano::log::type::bootstrap, "Stopping slow peer {} (elapsed sec {} > {} and {} blocks per second < {})", + node.logger.debug (nano::log::type::bootstrap, "Stopping slow peer {} (elapsed sec {} > {} and {} blocks per second < {})", client->channel->to_string (), elapsed_sec, nano::bootstrap_limits::bootstrap_minimum_termination_time_sec, @@ -257,13 +257,13 @@ void nano::bootstrap_connections::populate_connections (bool repeat) // 4 -> 1, 8 -> 2, 16 -> 4, arbitrary, but seems to work well. auto drop = (int)roundf (sqrtf ((float)target - 2.0f)); - node.nlogger.debug (nano::log::type::bootstrap, "Dropping {} bulk pull peers, target connections {}", drop, target); + node.logger.debug (nano::log::type::bootstrap, "Dropping {} bulk pull peers, target connections {}", drop, target); for (int i = 0; i < drop; i++) { auto client = sorted_connections.top (); - node.nlogger.debug (nano::log::type::bootstrap, "Dropping peer with block rate {} and block count {} ({})", + node.logger.debug (nano::log::type::bootstrap, "Dropping peer with block rate {} and block count {} ({})", client->block_rate.load (), client->block_count.load (), client->channel->to_string ()); @@ -273,7 +273,7 @@ void nano::bootstrap_connections::populate_connections (bool repeat) } } - node.nlogger.debug (nano::log::type::bootstrap, "Bulk pull connections: {}, rate: {} blocks/sec, bootstrap attempts {}, remaining pulls: {}", + node.logger.debug (nano::log::type::bootstrap, "Bulk pull connections: {}, rate: {} blocks/sec, bootstrap attempts {}, remaining pulls: {}", connections_count.load (), (int)rate_sum, attempts_count, @@ -420,7 +420,7 @@ void nano::bootstrap_connections::requeue_pull (nano::pull_info const & pull_a, else { node.stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_failed_account, nano::stat::dir::in); - node.nlogger.debug (nano::log::type::bootstrap, "Failed to pull account {} or head block {} down to {} after {} attempts and {} blocks processed", + node.logger.debug (nano::log::type::bootstrap, "Failed to pull account {} or head block {} down to {} after {} attempts and {} blocks processed", pull.account_or_head.to_account (), pull.account_or_head.to_string (), pull.end.to_string (), diff --git a/nano/node/bootstrap/bootstrap_frontier.cpp b/nano/node/bootstrap/bootstrap_frontier.cpp index b438c8a22d..7a9d580361 100644 --- a/nano/node/bootstrap/bootstrap_frontier.cpp +++ b/nano/node/bootstrap/bootstrap_frontier.cpp @@ -42,7 +42,7 @@ void nano::frontier_req_client::run (nano::account const & start_account_a, uint } else { - node->nlogger.debug (nano::log::type::frontier_req_client, "Error while sending bootstrap request: {}", ec.message ()); + node->logger.debug (nano::log::type::frontier_req_client, "Error while sending bootstrap request: {}", ec.message ()); } }, nano::transport::buffer_drop_policy::no_limiter_drop); @@ -73,7 +73,7 @@ void nano::frontier_req_client::receive_frontier () } else { - node->nlogger.debug (nano::log::type::frontier_req_client, "Invalid size: expected {}, got {}", nano::frontier_req_client::size_frontier, size_a); + node->logger.debug (nano::log::type::frontier_req_client, "Invalid size: expected {}, got {}", nano::frontier_req_client::size_frontier, size_a); } }); } @@ -131,7 +131,7 @@ void nano::frontier_req_client::received_frontier (boost::system::error_code con double age_factor = (frontiers_age == std::numeric_limits::max ()) ? 1.0 : 1.5; // Allow slower frontiers receive for requests with age if (elapsed_sec > nano::bootstrap_limits::bootstrap_connection_warmup_time_sec && blocks_per_sec * age_factor < nano::bootstrap_limits::bootstrap_minimum_frontier_blocks_per_sec) { - node->nlogger.debug (nano::log::type::frontier_req_client, "Aborting frontier req because it was too slow: {} frontiers per second, last {}", blocks_per_sec, account.to_account ()); + node->logger.debug (nano::log::type::frontier_req_client, "Aborting frontier req because it was too slow: {} frontiers per second, last {}", blocks_per_sec, account.to_account ()); promise.set_value (true); return; @@ -139,7 +139,7 @@ void nano::frontier_req_client::received_frontier (boost::system::error_code con if (attempt->should_log ()) { - node->nlogger.debug (nano::log::type::frontier_req_client, "Received {} frontiers from {}", count, connection->channel->to_string ()); + node->logger.debug (nano::log::type::frontier_req_client, "Received {} frontiers from {}", count, connection->channel->to_string ()); } if (!account.is_zero () && count <= count_limit) @@ -201,7 +201,7 @@ void nano::frontier_req_client::received_frontier (boost::system::error_code con // Prevent new frontier_req requests attempt->set_start_account (std::numeric_limits::max ()); - node->nlogger.debug (nano::log::type::frontier_req_client, "Bulk push cost: {}", bulk_push_cost); + node->logger.debug (nano::log::type::frontier_req_client, "Bulk push cost: {}", bulk_push_cost); } else { @@ -220,7 +220,7 @@ void nano::frontier_req_client::received_frontier (boost::system::error_code con } else { - node->nlogger.debug (nano::log::type::frontier_req_client, "Error while receiving frontier: {}", ec.message ()); + node->logger.debug (nano::log::type::frontier_req_client, "Error while receiving frontier: {}", ec.message ()); } } @@ -311,7 +311,7 @@ void nano::frontier_req_server::send_finished () write (stream, zero.bytes); } - node->nlogger.debug (nano::log::type::frontier_req_server, "Frontier sending finished"); + node->logger.debug (nano::log::type::frontier_req_server, "Frontier sending finished"); auto this_l (shared_from_this ()); connection->socket->async_write (nano::shared_const_buffer (std::move (send_buffer)), [this_l] (boost::system::error_code const & ec, std::size_t size_a) { @@ -332,7 +332,7 @@ void nano::frontier_req_server::no_block_sent (boost::system::error_code const & } else { - node->nlogger.debug (nano::log::type::frontier_req_server, "Error sending frontier finish: {}", ec.message ()); + node->logger.debug (nano::log::type::frontier_req_server, "Error sending frontier finish: {}", ec.message ()); } } @@ -353,7 +353,7 @@ void nano::frontier_req_server::sent_action (boost::system::error_code const & e } else { - node->nlogger.debug (nano::log::type::frontier_req_server, "Error sending frontier pair: {}", ec.message ()); + node->logger.debug (nano::log::type::frontier_req_server, "Error sending frontier pair: {}", ec.message ()); } } diff --git a/nano/node/bootstrap/bootstrap_lazy.cpp b/nano/node/bootstrap/bootstrap_lazy.cpp index 35b0153120..0d3dbc9408 100644 --- a/nano/node/bootstrap/bootstrap_lazy.cpp +++ b/nano/node/bootstrap/bootstrap_lazy.cpp @@ -250,11 +250,11 @@ void nano::bootstrap_attempt_lazy::run () } if (!stopped) { - node->nlogger.debug (nano::log::type::bootstrap_lazy, "Completed lazy pulls"); + node->logger.debug (nano::log::type::bootstrap_lazy, "Completed lazy pulls"); } if (lazy_has_expired ()) { - node->nlogger.debug (nano::log::type::bootstrap_lazy, "Lazy bootstrap attempt ID {} expired", id); + node->logger.debug (nano::log::type::bootstrap_lazy, "Lazy bootstrap attempt ID {} expired", id); } lock.unlock (); stop (); @@ -613,7 +613,7 @@ void nano::bootstrap_attempt_wallet::run () } if (!stopped) { - node->nlogger.info (nano::log::type::bootstrap_lazy, "Completed wallet lazy pulls"); + node->logger.info (nano::log::type::bootstrap_lazy, "Completed wallet lazy pulls"); } lock.unlock (); stop (); diff --git a/nano/node/bootstrap/bootstrap_legacy.cpp b/nano/node/bootstrap/bootstrap_legacy.cpp index 2a1c670979..25605c91b5 100644 --- a/nano/node/bootstrap/bootstrap_legacy.cpp +++ b/nano/node/bootstrap/bootstrap_legacy.cpp @@ -180,7 +180,7 @@ bool nano::bootstrap_attempt_legacy::request_frontier (nano::unique_locknlogger.debug (nano::log::type::bootstrap_legacy, "Completed frontier request, {} out of sync accounts according to {}", account_count.load (), connection_l->channel->to_string ()); + node->logger.debug (nano::log::type::bootstrap_legacy, "Completed frontier request, {} out of sync accounts according to {}", account_count.load (), connection_l->channel->to_string ()); } else { @@ -230,7 +230,7 @@ void nano::bootstrap_attempt_legacy::run () if (start_account.number () != std::numeric_limits::max ()) { - node->nlogger.debug(nano::log::type::bootstrap_legacy, "Requesting new frontiers after: {}", start_account.to_account ()); + node->logger.debug(nano::log::type::bootstrap_legacy, "Requesting new frontiers after: {}", start_account.to_account ()); // Requesting new frontiers run_start (lock); @@ -238,7 +238,7 @@ void nano::bootstrap_attempt_legacy::run () } if (!stopped) { - node->nlogger.debug(nano::log::type::bootstrap_legacy, "Completed legacy pulls"); + node->logger.debug(nano::log::type::bootstrap_legacy, "Completed legacy pulls"); if (!node->flags.disable_bootstrap_bulk_push_client) { diff --git a/nano/node/cli.cpp b/nano/node/cli.cpp index 4bb19c8747..ce9369fc14 100644 --- a/nano/node/cli.cpp +++ b/nano/node/cli.cpp @@ -255,7 +255,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map if (vm.count ("initialize")) { // TODO: --config flag overrides are not taken into account here - nano::nlogger::initialize (nano::log_config::daemon_default (), data_path); + nano::logger::initialize (nano::log_config::daemon_default (), data_path); auto node_flags = nano::inactive_node_flag_defaults (); node_flags.read_only = false; diff --git a/nano/node/confirmation_height_bounded.cpp b/nano/node/confirmation_height_bounded.cpp index 8bcb25756a..9136dc7c5d 100644 --- a/nano/node/confirmation_height_bounded.cpp +++ b/nano/node/confirmation_height_bounded.cpp @@ -10,11 +10,11 @@ #include -nano::confirmation_height_bounded::confirmation_height_bounded (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::nlogger & nlogger_a, std::atomic & stopped_a, uint64_t & batch_write_size_a, std::function> const &)> const & notify_observers_callback_a, std::function const & notify_block_already_cemented_observers_callback_a, std::function const & awaiting_processing_size_callback_a) : +nano::confirmation_height_bounded::confirmation_height_bounded (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::logger & logger_a, std::atomic & stopped_a, uint64_t & batch_write_size_a, std::function> const &)> const & notify_observers_callback_a, std::function const & notify_block_already_cemented_observers_callback_a, std::function const & awaiting_processing_size_callback_a) : ledger (ledger_a), write_database_queue (write_database_queue_a), batch_separate_pending_min_time (batch_separate_pending_min_time_a), - nlogger (nlogger_a), + logger (logger_a), stopped (stopped_a), batch_write_size (batch_write_size_a), notify_observers_callback (notify_observers_callback_a), @@ -98,7 +98,7 @@ void nano::confirmation_height_bounded::process (std::shared_ptr or } else { - nlogger.critical (nano::log::type::conf_processor_bounded, "Ledger mismatch trying to set confirmation height for block {} (bounded processor)", current.to_string ()); + logger.critical (nano::log::type::conf_processor_bounded, "Ledger mismatch trying to set confirmation height for block {} (bounded processor)", current.to_string ()); release_assert (block); } @@ -429,7 +429,7 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope { if (!block) { - nlogger.critical (nano::log::type::conf_processor_bounded, "Failed to write confirmation height for block {} (bounded processor)", new_cemented_frontier.to_string ()); + logger.critical (nano::log::type::conf_processor_bounded, "Failed to write confirmation height for block {} (bounded processor)", new_cemented_frontier.to_string ()); // Undo any blocks about to be cemented from this account for this pending write. cemented_blocks.erase (cemented_blocks.end () - num_blocks_iterated, cemented_blocks.end ()); diff --git a/nano/node/confirmation_height_bounded.hpp b/nano/node/confirmation_height_bounded.hpp index ee453769cd..a5052b1452 100644 --- a/nano/node/confirmation_height_bounded.hpp +++ b/nano/node/confirmation_height_bounded.hpp @@ -18,7 +18,7 @@ class write_guard; class confirmation_height_bounded final { public: - confirmation_height_bounded (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds batch_separate_pending_min_time, nano::nlogger &, std::atomic & stopped, uint64_t & batch_write_size, std::function> const &)> const & cemented_callback, std::function const & already_cemented_callback, std::function const & awaiting_processing_size_query); + confirmation_height_bounded (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds batch_separate_pending_min_time, nano::logger &, std::atomic & stopped, uint64_t & batch_write_size, std::function> const &)> const & cemented_callback, std::function const & already_cemented_callback, std::function const & awaiting_processing_size_query); bool pending_empty () const; void clear_process_vars (); @@ -121,7 +121,7 @@ class confirmation_height_bounded final nano::ledger & ledger; nano::write_database_queue & write_database_queue; std::chrono::milliseconds batch_separate_pending_min_time; - nano::nlogger & nlogger; + nano::logger & logger; std::atomic & stopped; uint64_t & batch_write_size; std::function> const &)> notify_observers_callback; diff --git a/nano/node/confirmation_height_processor.cpp b/nano/node/confirmation_height_processor.cpp index a3c9b325c7..4b9d9d82a6 100644 --- a/nano/node/confirmation_height_processor.cpp +++ b/nano/node/confirmation_height_processor.cpp @@ -8,16 +8,16 @@ #include -nano::confirmation_height_processor::confirmation_height_processor (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::nlogger & nlogger_a, boost::latch & latch, confirmation_height_mode mode_a) : +nano::confirmation_height_processor::confirmation_height_processor (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::logger & logger_a, boost::latch & latch, confirmation_height_mode mode_a) : ledger (ledger_a), write_database_queue (write_database_queue_a), unbounded_processor ( - ledger_a, write_database_queue_a, batch_separate_pending_min_time_a, nlogger_a, stopped, batch_write_size, + ledger_a, write_database_queue_a, batch_separate_pending_min_time_a, logger_a, stopped, batch_write_size, /* cemented_callback */ [this] (auto & cemented_blocks) { this->notify_cemented (cemented_blocks); }, /* already cemented_callback */ [this] (auto const & block_hash_a) { this->notify_already_cemented (block_hash_a); }, /* awaiting_processing_size_query */ [this] () { return this->awaiting_processing_size (); }), bounded_processor ( - ledger_a, write_database_queue_a, batch_separate_pending_min_time_a, nlogger_a, stopped, batch_write_size, + ledger_a, write_database_queue_a, batch_separate_pending_min_time_a, logger_a, stopped, batch_write_size, /* cemented_callback */ [this] (auto & cemented_blocks) { this->notify_cemented (cemented_blocks); }, /* already cemented_callback */ [this] (auto const & block_hash_a) { this->notify_already_cemented (block_hash_a); }, /* awaiting_processing_size_query */ [this] () { return this->awaiting_processing_size (); }), diff --git a/nano/node/confirmation_height_processor.hpp b/nano/node/confirmation_height_processor.hpp index 1767f82106..d31267833f 100644 --- a/nano/node/confirmation_height_processor.hpp +++ b/nano/node/confirmation_height_processor.hpp @@ -30,7 +30,7 @@ class write_database_queue; class confirmation_height_processor final { public: - confirmation_height_processor (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds, nano::nlogger &, boost::latch & initialized_latch, confirmation_height_mode = confirmation_height_mode::automatic); + confirmation_height_processor (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds, nano::logger &, boost::latch & initialized_latch, confirmation_height_mode = confirmation_height_mode::automatic); ~confirmation_height_processor (); void pause (); diff --git a/nano/node/confirmation_height_unbounded.cpp b/nano/node/confirmation_height_unbounded.cpp index 4b7f9fffe5..8f50f39dcb 100644 --- a/nano/node/confirmation_height_unbounded.cpp +++ b/nano/node/confirmation_height_unbounded.cpp @@ -10,11 +10,11 @@ #include -nano::confirmation_height_unbounded::confirmation_height_unbounded (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::nlogger & nlogger_a, std::atomic & stopped_a, uint64_t & batch_write_size_a, std::function> const &)> const & notify_observers_callback_a, std::function const & notify_block_already_cemented_observers_callback_a, std::function const & awaiting_processing_size_callback_a) : +nano::confirmation_height_unbounded::confirmation_height_unbounded (nano::ledger & ledger_a, nano::write_database_queue & write_database_queue_a, std::chrono::milliseconds batch_separate_pending_min_time_a, nano::logger & logger_a, std::atomic & stopped_a, uint64_t & batch_write_size_a, std::function> const &)> const & notify_observers_callback_a, std::function const & notify_block_already_cemented_observers_callback_a, std::function const & awaiting_processing_size_callback_a) : ledger (ledger_a), write_database_queue (write_database_queue_a), batch_separate_pending_min_time (batch_separate_pending_min_time_a), - nlogger (nlogger_a), + logger (logger_a), stopped (stopped_a), batch_write_size (batch_write_size_a), notify_observers_callback (notify_observers_callback_a), @@ -74,7 +74,7 @@ void nano::confirmation_height_unbounded::process (std::shared_ptr } if (!block) { - nlogger.critical (nano::log::type::conf_processor_unbounded, "Ledger mismatch trying to set confirmation height for block {} (unbounded processor)", current.to_string ()); + logger.critical (nano::log::type::conf_processor_unbounded, "Ledger mismatch trying to set confirmation height for block {} (unbounded processor)", current.to_string ()); } release_assert (block); @@ -390,7 +390,7 @@ void nano::confirmation_height_unbounded::cement_blocks (nano::write_guard & sco } else { - nlogger.critical (nano::log::type::conf_processor_unbounded, "Failed to write confirmation height for block {} (unbounded processor)", pending.hash.to_string ()); + logger.critical (nano::log::type::conf_processor_unbounded, "Failed to write confirmation height for block {} (unbounded processor)", pending.hash.to_string ()); error = true; break; diff --git a/nano/node/confirmation_height_unbounded.hpp b/nano/node/confirmation_height_unbounded.hpp index 2264d6fa06..ea3e7e52a1 100644 --- a/nano/node/confirmation_height_unbounded.hpp +++ b/nano/node/confirmation_height_unbounded.hpp @@ -19,7 +19,7 @@ class write_guard; class confirmation_height_unbounded final { public: - confirmation_height_unbounded (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds batch_separate_pending_min_time, nano::nlogger &, std::atomic & stopped, uint64_t & batch_write_size, std::function> const &)> const & cemented_callback, std::function const & already_cemented_callback, std::function const & awaiting_processing_size_query); + confirmation_height_unbounded (nano::ledger &, nano::write_database_queue &, std::chrono::milliseconds batch_separate_pending_min_time, nano::logger &, std::atomic & stopped, uint64_t & batch_write_size, std::function> const &)> const & cemented_callback, std::function const & already_cemented_callback, std::function const & awaiting_processing_size_query); bool pending_empty () const; void clear_process_vars (); @@ -98,7 +98,7 @@ class confirmation_height_unbounded final nano::ledger & ledger; nano::write_database_queue & write_database_queue; std::chrono::milliseconds batch_separate_pending_min_time; - nano::nlogger & nlogger; + nano::logger & logger; std::atomic & stopped; uint64_t & batch_write_size; diff --git a/nano/node/distributed_work.cpp b/nano/node/distributed_work.cpp index d7031f5f18..7d1849fb9b 100644 --- a/nano/node/distributed_work.cpp +++ b/nano/node/distributed_work.cpp @@ -94,7 +94,7 @@ void nano::distributed_work::start () } else { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Error resolving work peer: {}:{} ({})", peer.first, peer.second, ec.message ()); + this_l->node.logger.error (nano::log::type::distributed_work, "Error resolving work peer: {}:{} ({})", peer.first, peer.second, ec.message ()); this_l->failure (); } @@ -167,7 +167,7 @@ void nano::distributed_work::do_request (nano::tcp_endpoint const & endpoint_a) } else if (ec) { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Work peer responded with an error {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Work peer responded with an error {}:{} ({})", nano::util::to_str (connection->endpoint.address ()), connection->endpoint.port (), ec.message ()); @@ -185,7 +185,7 @@ void nano::distributed_work::do_request (nano::tcp_endpoint const & endpoint_a) } else if (ec && ec != boost::system::errc::operation_canceled) { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Unable to write to work peer {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Unable to write to work peer {}:{} ({})", nano::util::to_str (connection->endpoint.address ()), connection->endpoint.port (), ec.message ()); @@ -197,7 +197,7 @@ void nano::distributed_work::do_request (nano::tcp_endpoint const & endpoint_a) } else if (ec && ec != boost::system::errc::operation_canceled) { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Unable to connect to work peer {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Unable to connect to work peer {}:{} ({})", nano::util::to_str (connection->endpoint.address ()), connection->endpoint.port (), ec.message ()); @@ -232,7 +232,7 @@ void nano::distributed_work::do_cancel (nano::tcp_endpoint const & endpoint_a) [this_l, peer_cancel, cancelling_l] (boost::system::error_code const & ec, std::size_t bytes_transferred) { if (ec && ec != boost::system::errc::operation_canceled) { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Unable to send work cancel to work peer {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Unable to send work cancel to work peer {}:{} ({})", nano::util::to_str (cancelling_l->endpoint.address ()), cancelling_l->endpoint.port (), ec.message ()); @@ -263,7 +263,7 @@ void nano::distributed_work::success (std::string const & body_a, nano::tcp_endp } else { - node.nlogger.error (nano::log::type::distributed_work, "Incorrect work response from {}:{} for root {} with diffuculty {}: {}", + node.logger.error (nano::log::type::distributed_work, "Incorrect work response from {}:{} for root {} with diffuculty {}: {}", nano::util::to_str (endpoint_a.address ()), endpoint_a.port (), request.root.to_string (), @@ -273,7 +273,7 @@ void nano::distributed_work::success (std::string const & body_a, nano::tcp_endp } else { - node.nlogger.error (nano::log::type::distributed_work, "Work response from {}:{} wasn't a number: {}", + node.logger.error (nano::log::type::distributed_work, "Work response from {}:{} wasn't a number: {}", nano::util::to_str (endpoint_a.address ()), endpoint_a.port (), work_text); @@ -281,7 +281,7 @@ void nano::distributed_work::success (std::string const & body_a, nano::tcp_endp } catch (...) { - node.nlogger.error (nano::log::type::distributed_work, "Work response from {}:{} wasn't parsable: {}", + node.logger.error (nano::log::type::distributed_work, "Work response from {}:{} wasn't parsable: {}", nano::util::to_str (endpoint_a.address ()), endpoint_a.port (), body_a); @@ -317,7 +317,7 @@ void nano::distributed_work::stop_once (bool const local_stop_a) connection_l->socket.close (ec); if (ec) { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Error closing socket with work peer: {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Error closing socket with work peer: {}:{} ({})", nano::util::to_str (connection_l->endpoint.address ()), connection_l->endpoint.port (), ec.message ()); @@ -325,7 +325,7 @@ void nano::distributed_work::stop_once (bool const local_stop_a) } else { - this_l->node.nlogger.error (nano::log::type::distributed_work, "Error cancelling operation with work peer: {}:{} ({})", + this_l->node.logger.error (nano::log::type::distributed_work, "Error cancelling operation with work peer: {}:{} ({})", nano::util::to_str (connection_l->endpoint.address ()), connection_l->endpoint.port (), ec.message ()); @@ -344,7 +344,7 @@ void nano::distributed_work::set_once (uint64_t const work_a, std::string const { elapsed.stop (); - node.nlogger.info (nano::log::type::distributed_work, "Work generation for {}, with a threshold difficulty of {} (multiplier {}x) complete: {} ms", + node.logger.info (nano::log::type::distributed_work, "Work generation for {}, with a threshold difficulty of {} (multiplier {}x) complete: {} ms", request.root.to_string (), nano::to_string_hex (request.difficulty), nano::to_string (nano::difficulty::to_multiplier (request.difficulty, node.default_difficulty (request.version)), 2), @@ -366,7 +366,7 @@ void nano::distributed_work::cancel () { elapsed.stop (); - node.nlogger.info (nano::log::type::distributed_work, "Work generation for {} was cancelled after {} ms", + node.logger.info (nano::log::type::distributed_work, "Work generation for {} was cancelled after {} ms", request.root.to_string (), elapsed.value ().count ()); @@ -394,7 +394,7 @@ void nano::distributed_work::handle_failure () node.unresponsive_work_peers = true; if (!local_generation_started && !finished.exchange (true)) { - node.nlogger.info (nano::log::type::distributed_work, "Work peer(s) failed to generate work for root {}, retrying... (backoff: {}s)", + node.logger.info (nano::log::type::distributed_work, "Work peer(s) failed to generate work for root {}, retrying... (backoff: {}s)", request.root.to_string (), backoff.count ()); diff --git a/nano/node/epoch_upgrader.cpp b/nano/node/epoch_upgrader.cpp index c9443cd367..df30195032 100644 --- a/nano/node/epoch_upgrader.cpp +++ b/nano/node/epoch_upgrader.cpp @@ -2,12 +2,12 @@ #include #include -nano::epoch_upgrader::epoch_upgrader (nano::node & node_a, nano::ledger & ledger_a, nano::store::component & store_a, nano::network_params & network_params_a, nano::nlogger & nlogger_a) : +nano::epoch_upgrader::epoch_upgrader (nano::node & node_a, nano::ledger & ledger_a, nano::store::component & store_a, nano::network_params & network_params_a, nano::logger & logger_a) : node{ node_a }, ledger{ ledger_a }, store{ store_a }, network_params{ network_params_a }, - nlogger{ nlogger_a } + logger{ logger_a } { } @@ -60,7 +60,7 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc { bool fork (result == nano::process_result::fork); - nlogger.error (nano::log::type::epoch_upgrader, "Failed to upgrade account {} (valid signature: {}, valid work: {}, fork: {})", + logger.error (nano::log::type::epoch_upgrader, "Failed to upgrade account {} (valid signature: {}, valid work: {}, fork: {})", account_a.to_account (), valid_signature, valid_work, @@ -186,7 +186,7 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc if (!accounts_list.empty ()) { - nlogger.info (nano::log::type::epoch_upgrader, "{} accounts were upgraded to new epoch, {} remain...", + logger.info (nano::log::type::epoch_upgrader, "{} accounts were upgraded to new epoch, {} remain...", total_upgraded_accounts, accounts_list.size () - upgraded_accounts); @@ -194,7 +194,7 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc } else { - nlogger.info (nano::log::type::epoch_upgrader, "{} total accounts were upgraded to new epoch", total_upgraded_accounts); + logger.info (nano::log::type::epoch_upgrader, "{} total accounts were upgraded to new epoch", total_upgraded_accounts); finished_accounts = true; } @@ -293,11 +293,11 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc // Repeat if some pending accounts were upgraded if (upgraded_pending != 0) { - nlogger.info (nano::log::type::epoch_upgrader, "{} unopened accounts with pending blocks were upgraded to new epoch...", total_upgraded_pending); + logger.info (nano::log::type::epoch_upgrader, "{} unopened accounts with pending blocks were upgraded to new epoch...", total_upgraded_pending); } else { - nlogger.info (nano::log::type::epoch_upgrader, "{} total unopened accounts with pending blocks were upgraded to new epoch", total_upgraded_pending); + logger.info (nano::log::type::epoch_upgrader, "{} total unopened accounts with pending blocks were upgraded to new epoch", total_upgraded_pending); finished_pending = true; } @@ -306,5 +306,5 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc finished_upgrade = (total_upgraded_accounts == 0) && (total_upgraded_pending == 0); } - nlogger.info (nano::log::type::epoch_upgrader, "Epoch upgrade is completed"); + logger.info (nano::log::type::epoch_upgrader, "Epoch upgrade is completed"); } diff --git a/nano/node/epoch_upgrader.hpp b/nano/node/epoch_upgrader.hpp index 3f85b9985b..d9bccad98e 100644 --- a/nano/node/epoch_upgrader.hpp +++ b/nano/node/epoch_upgrader.hpp @@ -20,7 +20,7 @@ class network_params; class epoch_upgrader final { public: - epoch_upgrader (nano::node &, nano::ledger &, nano::store::component &, nano::network_params &, nano::nlogger &); + epoch_upgrader (nano::node &, nano::ledger &, nano::store::component &, nano::network_params &, nano::logger &); bool start (nano::raw_key const & prv, nano::epoch epoch, uint64_t count_limit, uint64_t threads); void stop (); @@ -30,7 +30,7 @@ class epoch_upgrader final nano::ledger & ledger; nano::store::component & store; nano::network_params & network_params; - nano::nlogger & nlogger; + nano::logger & logger; private: void upgrade_impl (nano::raw_key const & prv, nano::epoch epoch, uint64_t count_limit, uint64_t threads); diff --git a/nano/node/gap_cache.cpp b/nano/node/gap_cache.cpp index 384f1888b6..1ef81dd598 100644 --- a/nano/node/gap_cache.cpp +++ b/nano/node/gap_cache.cpp @@ -100,7 +100,7 @@ void nano::gap_cache::bootstrap_start (nano::block_hash const & hash_a) { if (!node_l->bootstrap_initiator.in_progress ()) { - node_l->nlogger.debug (nano::log::type::gap_cache, "Block {} has enough votes to warrant lazy bootstrapping it", hash_a.to_string ()); + node_l->logger.debug (nano::log::type::gap_cache, "Block {} has enough votes to warrant lazy bootstrapping it", hash_a.to_string ()); } if (!node_l->flags.disable_lazy_bootstrap) { diff --git a/nano/node/ipc/ipc_broker.cpp b/nano/node/ipc/ipc_broker.cpp index cf625ee791..15ba718cca 100644 --- a/nano/node/ipc/ipc_broker.cpp +++ b/nano/node/ipc/ipc_broker.cpp @@ -65,17 +65,17 @@ void nano::ipc::broker::start () } catch (nano::error const & err) { - this_l->node.nlogger.error (nano::log::type::ipc, "Could not broadcast message: {}", err.get_message ()); + this_l->node.logger.error (nano::log::type::ipc, "Could not broadcast message: {}", err.get_message ()); } }); } template -void subscribe_or_unsubscribe (nano::nlogger & nlogger, COLL & subscriber_collection, std::weak_ptr const & subscriber_a, TOPIC_TYPE topic_a) +void subscribe_or_unsubscribe (nano::logger & logger, COLL & subscriber_collection, std::weak_ptr const & subscriber_a, TOPIC_TYPE topic_a) { // Evict subscribers from dead sessions. Also remove current subscriber if unsubscribing. subscriber_collection.erase (std::remove_if (subscriber_collection.begin (), subscriber_collection.end (), - [&nlogger = nlogger, topic_a, subscriber_a] (auto & sub) { + [&logger = logger, topic_a, subscriber_a] (auto & sub) { bool remove = false; auto subscriber_l = sub.subscriber.lock (); if (subscriber_l) @@ -85,7 +85,7 @@ void subscribe_or_unsubscribe (nano::nlogger & nlogger, COLL & subscriber_collec remove = topic_a->unsubscribe && subscriber_l->get_id () == calling_subscriber_l->get_id (); if (remove) { - nlogger.info (nano::log::type::ipc, "Subscriber ubsubscribed #{}", calling_subscriber_l->get_id ()); + logger.info (nano::log::type::ipc, "Subscriber ubsubscribed #{}", calling_subscriber_l->get_id ()); } } } @@ -106,7 +106,7 @@ void subscribe_or_unsubscribe (nano::nlogger & nlogger, COLL & subscriber_collec void nano::ipc::broker::subscribe (std::weak_ptr const & subscriber_a, std::shared_ptr const & confirmation_a) { auto subscribers = confirmation_subscribers.lock (); - subscribe_or_unsubscribe (node.nlogger, subscribers.get (), subscriber_a, confirmation_a); + subscribe_or_unsubscribe (node.logger, subscribers.get (), subscriber_a, confirmation_a); } void nano::ipc::broker::broadcast (std::shared_ptr const & confirmation_a) @@ -257,5 +257,5 @@ void nano::ipc::broker::service_stop (std::string const & service_name_a) void nano::ipc::broker::subscribe (std::weak_ptr const & subscriber_a, std::shared_ptr const & service_stop_a) { auto subscribers = service_stop_subscribers.lock (); - subscribe_or_unsubscribe (node.nlogger, subscribers.get (), subscriber_a, service_stop_a); + subscribe_or_unsubscribe (node.logger, subscribers.get (), subscriber_a, service_stop_a); } diff --git a/nano/node/ipc/ipc_server.cpp b/nano/node/ipc/ipc_server.cpp index b629fc72e2..ab5b39ef02 100644 --- a/nano/node/ipc/ipc_server.cpp +++ b/nano/node/ipc/ipc_server.cpp @@ -37,7 +37,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f server (server_a), node (server_a.node), session_id (server_a.id_dispenser.fetch_add (1)), io_ctx (io_ctx_a), strand (io_ctx_a.get_executor ()), socket (io_ctx_a), config_transport (config_transport_a) { - node.nlogger.debug (nano::log::type::ipc, "Creating session with id: ", session_id.load ()); + node.logger.debug (nano::log::type::ipc, "Creating session with id: ", session_id.load ()); } ~session () @@ -229,7 +229,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f this_l->timer_cancel (); if (ec == boost::asio::error::broken_pipe || ec == boost::asio::error::connection_aborted || ec == boost::asio::error::connection_reset || ec == boost::asio::error::connection_refused) { - this_l->node.nlogger.error (nano::log::type::ipc, "Error reading: ", ec.message ()); + this_l->node.logger.error (nano::log::type::ipc, "Error reading: ", ec.message ()); } else if (bytes_transferred_a > 0) { @@ -253,7 +253,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f buffer->insert (buffer->end (), reinterpret_cast (&big), reinterpret_cast (&big) + sizeof (std::uint32_t)); buffer->insert (buffer->end (), body.begin (), body.end ()); - this_l->node.nlogger.debug (nano::log::type::ipc, "IPC/RPC request {} completed in: {} {}", + this_l->node.logger.debug (nano::log::type::ipc, "IPC/RPC request {} completed in: {} {}", request_id_l, this_l->session_timer.stop ().count (), this_l->session_timer.unit ()); @@ -267,7 +267,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f } else { - this_l->node.nlogger.error (nano::log::type::ipc, "Write failed: ", error_a.message ()); + this_l->node.logger.error (nano::log::type::ipc, "Write failed: ", error_a.message ()); } }); @@ -300,7 +300,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f this_l->active_encoding = static_cast (encoding); if (this_l->buffer[nano::ipc::preamble_offset::lead] != 'N' || this_l->buffer[nano::ipc::preamble_offset::reserved_1] != 0 || this_l->buffer[nano::ipc::preamble_offset::reserved_2] != 0) { - this_l->node.nlogger.error (nano::log::type::ipc, "Invalid preamble"); + this_l->node.logger.error (nano::log::type::ipc, "Invalid preamble"); } else if (encoding == static_cast (nano::ipc::payload_encoding::json_v1) || encoding == static_cast (nano::ipc::payload_encoding::json_v1_unsafe)) { @@ -334,7 +334,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f if (encoding == static_cast (nano::ipc::payload_encoding::flatbuffers_json)) { this_l->flatbuffers_handler->process_json (this_l->buffer.data (), this_l->buffer_size, [this_l] (std::shared_ptr const & body) { - this_l->node.nlogger.debug (nano::log::type::ipc, "IPC/Flatbuffer request completed in: {} {}", + this_l->node.logger.debug (nano::log::type::ipc, "IPC/Flatbuffer request completed in: {} {}", this_l->session_timer.stop ().count (), this_l->session_timer.unit ()); @@ -351,7 +351,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f } else { - this_l->node.nlogger.error (nano::log::type::ipc, "Write failed: {}", error_a.message ()); + this_l->node.logger.error (nano::log::type::ipc, "Write failed: {}", error_a.message ()); } }); }); @@ -359,7 +359,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f else { this_l->flatbuffers_handler->process (this_l->buffer.data (), this_l->buffer_size, [this_l] (std::shared_ptr const & fbb) { - this_l->node.nlogger.debug (nano::log::type::ipc, "IPC/Flatbuffer request completed in: {} {}", + this_l->node.logger.debug (nano::log::type::ipc, "IPC/Flatbuffer request completed in: {} {}", this_l->session_timer.stop ().count (), this_l->session_timer.unit ()); @@ -376,7 +376,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f } else { - this_l->node.nlogger.error (nano::log::type::ipc, "Write failed: {}", error_a.message ()); + this_l->node.logger.error (nano::log::type::ipc, "Write failed: {}", error_a.message ()); } }); }); @@ -386,7 +386,7 @@ class session final : public nano::ipc::socket_base, public std::enable_shared_f } else { - this_l->node.nlogger.error (nano::log::type::ipc, "Unsupported payload encoding"); + this_l->node.logger.error (nano::log::type::ipc, "Unsupported payload encoding"); } }); } @@ -511,7 +511,7 @@ class socket_transport : public nano::ipc::transport } else { - node->nlogger.error (nano::log::type::ipc, "Acceptor error: ", ec.message ()); + node->logger.error (nano::log::type::ipc, "Acceptor error: ", ec.message ()); } if (ec != boost::asio::error::operation_aborted && acceptor->is_open ()) @@ -520,7 +520,7 @@ class socket_transport : public nano::ipc::transport } else { - node->nlogger.info (nano::log::type::ipc, "Shutting down"); + node->logger.info (nano::log::type::ipc, "Shutting down"); } }); } @@ -613,7 +613,7 @@ nano::ipc::ipc_server::ipc_server (nano::node & node_a, nano::node_rpc_config co boost::asio::local::stream_protocol::endpoint ep{ node_a.config.ipc_config.transport_domain.path }; transports.push_back (std::make_shared (*this, ep, node_a.config.ipc_config.transport_domain, threads)); #else - node.nlogger.error (nano::log::type::ipc_server, "Domain sockets are not supported on this platform"); + node.logger.error (nano::log::type::ipc_server, "Domain sockets are not supported on this platform"); #endif } @@ -623,7 +623,7 @@ nano::ipc::ipc_server::ipc_server (nano::node & node_a, nano::node_rpc_config co transports.push_back (std::make_shared (*this, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v6 (), node_a.config.ipc_config.transport_tcp.port), node_a.config.ipc_config.transport_tcp, threads)); } - node.nlogger.debug (nano::log::type::ipc_server, "Server started"); + node.logger.debug (nano::log::type::ipc_server, "Server started"); if (!transports.empty ()) { @@ -632,13 +632,13 @@ nano::ipc::ipc_server::ipc_server (nano::node & node_a, nano::node_rpc_config co } catch (std::runtime_error const & ex) { - node.nlogger.error (nano::log::type::ipc_server, "Error: {}", ex.what ()); + node.logger.error (nano::log::type::ipc_server, "Error: {}", ex.what ()); } } nano::ipc::ipc_server::~ipc_server () { - node.nlogger.debug (nano::log::type::ipc_server, "Server stopped"); + node.logger.debug (nano::log::type::ipc_server, "Server stopped"); } void nano::ipc::ipc_server::stop () @@ -678,7 +678,7 @@ nano::error nano::ipc::ipc_server::reload_access_config () nano::error access_config_error (nano::ipc::read_access_config_toml (node.application_path, access)); if (access_config_error) { - node.nlogger.error (nano::log::type::ipc_server, "Invalid access configuration file: {}", access_config_error.get_message ()); + node.logger.error (nano::log::type::ipc_server, "Invalid access configuration file: {}", access_config_error.get_message ()); } return access_config_error; } diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index 3bd22bf980..58af00f1c5 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -2955,7 +2955,7 @@ void nano::json_handler::password_change () rpc_l->response_l.put ("changed", error ? "0" : "1"); if (!error) { - rpc_l->node.nlogger.warn (nano::log::type::rpc, "Wallet password changed"); + rpc_l->node.logger.warn (nano::log::type::rpc, "Wallet password changed"); } } } @@ -4774,7 +4774,7 @@ void nano::json_handler::wallet_lock () wallet->store.password.value_set (empty); response_l.put ("locked", "1"); - node.nlogger.warn (nano::log::type::rpc, "Wallet locked"); + node.logger.warn (nano::log::type::rpc, "Wallet locked"); } response_errors (); } diff --git a/nano/node/make_store.cpp b/nano/node/make_store.cpp index fda5c9ac20..c3c8c28105 100644 --- a/nano/node/make_store.cpp +++ b/nano/node/make_store.cpp @@ -2,7 +2,7 @@ #include #include -std::unique_ptr nano::make_store (nano::nlogger & logger, std::filesystem::path const & path, nano::ledger_constants & constants, bool read_only, bool add_db_postfix, nano::rocksdb_config const & rocksdb_config, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade) +std::unique_ptr nano::make_store (nano::logger & logger, std::filesystem::path const & path, nano::ledger_constants & constants, bool read_only, bool add_db_postfix, nano::rocksdb_config const & rocksdb_config, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade) { if (rocksdb_config.enable) { diff --git a/nano/node/make_store.hpp b/nano/node/make_store.hpp index b467c07ce8..5f5b5f9372 100644 --- a/nano/node/make_store.hpp +++ b/nano/node/make_store.hpp @@ -22,5 +22,5 @@ class component; namespace nano { -std::unique_ptr make_store (nano::nlogger &, std::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = true, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false); +std::unique_ptr make_store (nano::logger &, std::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = true, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false); } diff --git a/nano/node/network.cpp b/nano/node/network.cpp index ab81aa6b0a..d02026deac 100644 --- a/nano/node/network.cpp +++ b/nano/node/network.cpp @@ -38,22 +38,22 @@ nano::network::network (nano::node & node_a, uint16_t port_a) : } catch (boost::system::error_code & ec) { - node.nlogger.critical (nano::log::type::network, "Error: {}", ec.message ()); + node.logger.critical (nano::log::type::network, "Error: {}", ec.message ()); release_assert (false); } catch (std::error_code & ec) { - node.nlogger.critical (nano::log::type::network, "Error: {}", ec.message ()); + node.logger.critical (nano::log::type::network, "Error: {}", ec.message ()); release_assert (false); } catch (std::runtime_error & err) { - node.nlogger.critical (nano::log::type::network, "Error: {}", err.what ()); + node.logger.critical (nano::log::type::network, "Error: {}", err.what ()); release_assert (false); } catch (...) { - node.nlogger.critical (nano::log::type::network, "Unknown error"); + node.logger.critical (nano::log::type::network, "Unknown error"); release_assert (false); } }); @@ -127,7 +127,7 @@ void nano::network::send_node_id_handshake (std::shared_ptrget_endpoint ()), (query ? query->cookie.to_string () : ""), (respond_to ? respond_to->to_string () : ""), diff --git a/nano/node/node.cpp b/nano/node/node.cpp index 07c6922c6c..52ab7f1afd 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -84,7 +84,7 @@ void nano::node::keepalive (std::string const & address_a, uint16_t port_a) } else { - node_l->nlogger.error (nano::log::type::node, "Error resolving address for keepalive: {}:{} ({})", address_a, port_a, ec.message ()); + node_l->logger.error (nano::log::type::node, "Error resolving address for keepalive: {}:{} ({})", address_a, port_a, ec.message ()); } }); } @@ -144,14 +144,14 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons node_initialized_latch (1), config (config_a), network_params{ config.network_params }, - nlogger{ make_logger_identifier (node_id) }, + logger{ make_logger_identifier (node_id) }, stats (config.stats_config), workers{ config.background_threads, nano::thread_role::name::worker }, bootstrap_workers{ config.bootstrap_serving_threads, nano::thread_role::name::bootstrap_worker }, flags (flags_a), work (work_a), distributed_work (*this), - store_impl (nano::make_store (nlogger, application_path_a, network_params.ledger, flags.read_only, true, config_a.rocksdb_config, config_a.diagnostics_config.txn_tracking, config_a.block_processor_batch_max_time, config_a.lmdb_config, config_a.backup_before_upgrade)), + store_impl (nano::make_store (logger, application_path_a, network_params.ledger, flags.read_only, true, config_a.rocksdb_config, config_a.diagnostics_config.txn_tracking, config_a.block_processor_batch_max_time, config_a.lmdb_config, config_a.backup_before_upgrade)), store (*store_impl), unchecked{ stats, flags.disable_block_processor_unchecked_deletion }, wallets_store_impl (std::make_unique (application_path_a / "wallets.ldb", config_a.lmdb_config)), @@ -177,13 +177,13 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons application_path (application_path_a), port_mapping (*this), rep_crawler (*this), - vote_processor (active, observers, stats, config, flags, nlogger, online_reps, rep_crawler, ledger, network_params), + vote_processor (active, observers, stats, config, flags, logger, online_reps, rep_crawler, ledger, network_params), warmed_up (0), block_processor (*this, write_database_queue), online_reps (ledger, config), history{ config.network_params.voting }, vote_uniquer{}, - confirmation_height_processor (ledger, write_database_queue, config.conf_height_processor_batch_min_time, nlogger, node_initialized_latch, flags.confirmation_height_processor_mode), + confirmation_height_processor (ledger, write_database_queue, config.conf_height_processor_batch_min_time, logger, node_initialized_latch, flags.confirmation_height_processor_mode), vote_cache{ config.vote_cache, stats }, generator{ config, ledger, wallets, vote_processor, history, network, stats, /* non-final */ false }, final_generator{ config, ledger, wallets, vote_processor, history, network, stats, /* final */ true }, @@ -194,8 +194,8 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons wallets (wallets_store.init_error (), *this), backlog{ nano::backlog_population_config (config), store, stats }, ascendboot{ config, block_processor, ledger, network, stats }, - websocket{ config.websocket_config, observers, wallets, ledger, io_ctx, nlogger }, - epoch_upgrader{ *this, ledger, store, network_params, nlogger }, + websocket{ config.websocket_config, observers, wallets, ledger, io_ctx, logger }, + epoch_upgrader{ *this, ledger, store, network_params, logger }, startup_time (std::chrono::steady_clock::now ()), node_seq (seq), block_broadcast{ network, block_arrival, !flags.disable_block_processor_republishing }, @@ -203,7 +203,7 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons gap_tracker{ gap_cache }, process_live_dispatcher{ ledger, scheduler.priority, vote_cache, websocket } { - nlogger.debug (nano::log::type::node, "Constructing node..."); + logger.debug (nano::log::type::node, "Constructing node..."); block_broadcast.connect (block_processor); block_publisher.connect (block_processor); @@ -293,7 +293,7 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons } else { - node_l->nlogger.error (nano::log::type::rpc_callbacks, "Error resolving callback: {}:{} ({})", address, port, ec.message ()); + node_l->logger.error (nano::log::type::rpc_callbacks, "Error resolving callback: {}:{} ({})", address, port, ec.message ()); node_l->stats.inc (nano::stat::type::error, nano::stat::detail::http_callback, nano::stat::dir::out); } }); @@ -342,21 +342,21 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons auto const network_label = network_params.network.get_current_network_as_string (); - nlogger.info (nano::log::type::node, "Node starting, version: {}", NANO_VERSION_STRING); - nlogger.info (nano::log::type::node, "Build information: {}", BUILD_INFO); - nlogger.info (nano::log::type::node, "Active network: {}", network_label); - nlogger.info (nano::log::type::node, "Database backend: {}", store.vendor_get ()); - nlogger.info (nano::log::type::node, "Data path: {}", application_path.string ()); - nlogger.info (nano::log::type::node, "Work pool threads: {} ({})", work.threads.size (), (work.opencl ? "OpenCL" : "CPU")); - nlogger.info (nano::log::type::node, "Work peers: {}", config.work_peers.size ()); - nlogger.info (nano::log::type::node, "Node ID: {}", node_id.pub.to_node_id ()); + logger.info (nano::log::type::node, "Node starting, version: {}", NANO_VERSION_STRING); + logger.info (nano::log::type::node, "Build information: {}", BUILD_INFO); + logger.info (nano::log::type::node, "Active network: {}", network_label); + logger.info (nano::log::type::node, "Database backend: {}", store.vendor_get ()); + logger.info (nano::log::type::node, "Data path: {}", application_path.string ()); + logger.info (nano::log::type::node, "Work pool threads: {} ({})", work.threads.size (), (work.opencl ? "OpenCL" : "CPU")); + logger.info (nano::log::type::node, "Work peers: {}", config.work_peers.size ()); + logger.info (nano::log::type::node, "Node ID: {}", node_id.pub.to_node_id ()); if (!work_generation_enabled ()) { - nlogger.info (nano::log::type::node, "Work generation is disabled"); + logger.info (nano::log::type::node, "Work generation is disabled"); } - nlogger.info (nano::log::type::node, "Outbound bandwidth limit: {} bytes/s, burst ratio: {}", + logger.info (nano::log::type::node, "Outbound bandwidth limit: {} bytes/s, burst ratio: {}", config.bandwidth_limit, config.bandwidth_limit_burst_ratio); @@ -376,11 +376,11 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons if (!ledger.block_or_pruned_exists (config.network_params.ledger.genesis->hash ())) { - nlogger.critical (nano::log::type::node, "Genesis block not found. This commonly indicates a configuration issue, check that the --network or --data_path command line arguments are correct, and also the ledger backend node config option. If using a read-only CLI command a ledger must already exist, start the node with --daemon first."); + logger.critical (nano::log::type::node, "Genesis block not found. This commonly indicates a configuration issue, check that the --network or --data_path command line arguments are correct, and also the ledger backend node config option. If using a read-only CLI command a ledger must already exist, start the node with --daemon first."); if (network_params.network.is_beta_network ()) { - nlogger.critical (nano::log::type::node, "Beta network may have reset, try clearing database files"); + logger.critical (nano::log::type::node, "Beta network may have reset, try clearing database files"); } std::exit (1); @@ -389,14 +389,14 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons if (config.enable_voting) { auto reps = wallets.reps (); - nlogger.info (nano::log::type::node, "Voting is enabled, more system resources will be used, local representatives: {}", reps.accounts.size ()); + logger.info (nano::log::type::node, "Voting is enabled, more system resources will be used, local representatives: {}", reps.accounts.size ()); for (auto const & account : reps.accounts) { - nlogger.info (nano::log::type::node, "Local representative: {}", account.to_account ()); + logger.info (nano::log::type::node, "Local representative: {}", account.to_account ()); } if (reps.accounts.size () > 1) { - nlogger.warn (nano::log::type::node, "Voting with more than one representative can limit performance"); + logger.warn (nano::log::type::node, "Voting with more than one representative can limit performance"); } } @@ -405,18 +405,18 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons auto const bootstrap_weights = get_bootstrap_weights (); ledger.bootstrap_weight_max_blocks = bootstrap_weights.first; - nlogger.info (nano::log::type::node, "Initial bootstrap height: {}", ledger.bootstrap_weight_max_blocks); - nlogger.info (nano::log::type::node, "Current ledger height: {}", ledger.cache.block_count.load ()); + logger.info (nano::log::type::node, "Initial bootstrap height: {}", ledger.bootstrap_weight_max_blocks); + logger.info (nano::log::type::node, "Current ledger height: {}", ledger.cache.block_count.load ()); // Use bootstrap weights if initial bootstrap is not completed const bool use_bootstrap_weight = ledger.cache.block_count < bootstrap_weights.first; if (use_bootstrap_weight) { - nlogger.info (nano::log::type::node, "Using predefined representative weights, since block count is less than bootstrap threshold"); + logger.info (nano::log::type::node, "Using predefined representative weights, since block count is less than bootstrap threshold"); ledger.bootstrap_weights = bootstrap_weights.second; - nlogger.info (nano::log::type::node, "************************************ Bootstrap weights ************************************"); + logger.info (nano::log::type::node, "************************************ Bootstrap weights ************************************"); // Sort the weights std::vector> sorted_weights (ledger.bootstrap_weights.begin (), ledger.bootstrap_weights.end ()); @@ -426,18 +426,18 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons for (auto const & rep : sorted_weights) { - nlogger.info (nano::log::type::node, "Using bootstrap rep weight: {} -> {}", + logger.info (nano::log::type::node, "Using bootstrap rep weight: {} -> {}", rep.first.to_account (), nano::uint128_union (rep.second).format_balance (Mxrb_ratio, 0, true)); } - nlogger.info (nano::log::type::node, "************************************ ================= ************************************"); + logger.info (nano::log::type::node, "************************************ ================= ************************************"); } // Drop unchecked blocks if initial bootstrap is completed if (!flags.disable_unchecked_drop && !use_bootstrap_weight && !flags.read_only) { - nlogger.info (nano::log::type::node, "Dropping unchecked blocks..."); + logger.info (nano::log::type::node, "Dropping unchecked blocks..."); unchecked.clear (); } } @@ -448,12 +448,12 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons { if (config.enable_voting && !flags.inactive_node) { - nlogger.critical (nano::log::type::node, "Incompatibility detected between config node.enable_voting and existing pruned blocks"); + logger.critical (nano::log::type::node, "Incompatibility detected between config node.enable_voting and existing pruned blocks"); std::exit (1); } else if (!flags.enable_pruning && !flags.inactive_node) { - nlogger.critical (nano::log::type::node, "To start node with existing pruned blocks use launch flag --enable_pruning"); + logger.critical (nano::log::type::node, "To start node with existing pruned blocks use launch flag --enable_pruning"); std::exit (1); } } @@ -463,7 +463,7 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons nano::node::~node () { - nlogger.debug (nano::log::type::node, "Destructing node..."); + logger.debug (nano::log::type::node, "Destructing node..."); stop (); } @@ -499,27 +499,27 @@ void nano::node::do_rpc_callback (boost::asio::ip::tcp::resolver::iterator i_a, } else { - node_l->nlogger.error (nano::log::type::rpc_callbacks, "Callback to {}:{} failed [status: {}]", address, port, nano::util::to_str (resp->result ())); + node_l->logger.error (nano::log::type::rpc_callbacks, "Callback to {}:{} failed [status: {}]", address, port, nano::util::to_str (resp->result ())); node_l->stats.inc (nano::stat::type::error, nano::stat::detail::http_callback, nano::stat::dir::out); } } else { - node_l->nlogger.error (nano::log::type::rpc_callbacks, "Unable to complete callback: {}:{} ({})", address, port, ec.message ()); + node_l->logger.error (nano::log::type::rpc_callbacks, "Unable to complete callback: {}:{} ({})", address, port, ec.message ()); node_l->stats.inc (nano::stat::type::error, nano::stat::detail::http_callback, nano::stat::dir::out); }; }); } else { - node_l->nlogger.error (nano::log::type::rpc_callbacks, "Unable to send callback: {}:{} ({})", address, port, ec.message ()); + node_l->logger.error (nano::log::type::rpc_callbacks, "Unable to send callback: {}:{} ({})", address, port, ec.message ()); node_l->stats.inc (nano::stat::type::error, nano::stat::detail::http_callback, nano::stat::dir::out); } }); } else { - node_l->nlogger.error (nano::log::type::rpc_callbacks, "Unable to connect to callback address: {}:{} ({})", address, port, ec.message ()); + node_l->logger.error (nano::log::type::rpc_callbacks, "Unable to connect to callback address: {}:{} ({})", address, port, ec.message ()); node_l->stats.inc (nano::stat::type::error, nano::stat::detail::http_callback, nano::stat::dir::out); ++i_a; @@ -649,7 +649,7 @@ void nano::node::start () network.port = tcp_listener->endpoint ().port (); } - nlogger.info (nano::log::type::node, "Node peering port: {}", network.port.load ()); + logger.info (nano::log::type::node, "Node peering port: {}", network.port.load ()); } if (!flags.disable_backup) @@ -696,7 +696,7 @@ void nano::node::stop () return; } - nlogger.info (nano::log::type::node, "Node stopping..."); + logger.info (nano::log::type::node, "Node stopping..."); // Cancels ongoing work generation tasks, which may be blocking other threads // No tasks may wait for work generation in I/O threads, or termination signal capturing will be unable to call node::stop() @@ -805,7 +805,7 @@ void nano::node::long_inactivity_cleanup () { store.online_weight.clear (transaction); store.peer.clear (transaction); - nlogger.info (nano::log::type::node, "Removed records of peers and online weight after a long period of inactivity"); + logger.info (nano::log::type::node, "Removed records of peers and online weight after a long period of inactivity"); } } @@ -969,7 +969,7 @@ void nano::node::unchecked_cleanup () } if (!cleaning_list.empty ()) { - nlogger.info (nano::log::type::node, "Deleting {} old unchecked blocks", cleaning_list.size ()); + logger.info (nano::log::type::node, "Deleting {} old unchecked blocks", cleaning_list.size ()); } // Delete old unchecked keys in batches while (!cleaning_list.empty ()) @@ -1081,11 +1081,11 @@ void nano::node::ledger_pruning (uint64_t const batch_size_a, bool bootstrap_wei } pruned_count += transaction_write_count; - nlogger.debug (nano::log::type::prunning, "Pruned blocks: {}", pruned_count); + logger.debug (nano::log::type::prunning, "Pruned blocks: {}", pruned_count); } } - nlogger.debug (nano::log::type::prunning, "Total recently pruned block count: {}", pruned_count); + logger.debug (nano::log::type::prunning, "Total recently pruned block count: {}", pruned_count); } void nano::node::ongoing_ledger_pruning () @@ -1218,7 +1218,7 @@ void nano::node::add_initial_peers () { if (flags.disable_add_initial_peers) { - nlogger.warn (nano::log::type::node, "Not adding initial peers because `disable_add_initial_peers` flag is set"); + logger.warn (nano::log::type::node, "Not adding initial peers because `disable_add_initial_peers` flag is set"); return; } @@ -1298,12 +1298,12 @@ void nano::node::receive_confirmed (store::transaction const & block_transaction { if (!ledger.block_or_pruned_exists (block_transaction_a, hash_a)) { - nlogger.warn (nano::log::type::node, "Confirmed block is missing: {}", hash_a.to_string ()); + logger.warn (nano::log::type::node, "Confirmed block is missing: {}", hash_a.to_string ()); debug_assert (false, "Confirmed block is missing"); } else { - nlogger.warn (nano::log::type::node, "Block has already been received: {}", hash_a.to_string ()); + logger.warn (nano::log::type::node, "Block has already been received: {}", hash_a.to_string ()); } } } diff --git a/nano/node/node.hpp b/nano/node/node.hpp index f0408d6cc8..65d85830f0 100644 --- a/nano/node/node.hpp +++ b/nano/node/node.hpp @@ -146,7 +146,7 @@ class node final : public std::enable_shared_from_this boost::latch node_initialized_latch; nano::node_config config; nano::network_params & network_params; - nano::nlogger nlogger; + nano::logger logger; nano::stats stats; nano::thread_pool workers; nano::thread_pool bootstrap_workers; diff --git a/nano/node/openclwork.cpp b/nano/node/openclwork.cpp index e1d97f4e37..1e8907797d 100644 --- a/nano/node/openclwork.cpp +++ b/nano/node/openclwork.cpp @@ -250,7 +250,7 @@ void nano::opencl_environment::dump (std::ostream & stream) } } -nano::opencl_work::opencl_work (bool & error_a, nano::opencl_config const & config_a, nano::opencl_environment & environment_a, nano::nlogger & nlogger_a, nano::work_thresholds & work) : +nano::opencl_work::opencl_work (bool & error_a, nano::opencl_config const & config_a, nano::opencl_environment & environment_a, nano::logger & logger_a, nano::work_thresholds & work) : config (config_a), context (0), attempt_buffer (0), @@ -260,7 +260,7 @@ nano::opencl_work::opencl_work (bool & error_a, nano::opencl_config const & conf program (0), kernel (0), queue (0), - nlogger (nlogger_a), + logger (logger_a), work{ work } { error_a |= config.platform >= environment_a.platforms.size (); @@ -344,85 +344,85 @@ nano::opencl_work::opencl_work (bool & error_a, nano::opencl_config const & conf } else { - nlogger.error (nano::log::type::opencl_work, "Bind argument 3 error: {}", arg3_error); + logger.error (nano::log::type::opencl_work, "Bind argument 3 error: {}", arg3_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Bind argument 2 error: {}", arg2_error); + logger.error (nano::log::type::opencl_work, "Bind argument 2 error: {}", arg2_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Bind argument 1 error: {}", arg1_error); + logger.error (nano::log::type::opencl_work, "Bind argument 1 error: {}", arg1_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Bind argument 0 error: {}", arg0_error); + logger.error (nano::log::type::opencl_work, "Bind argument 0 error: {}", arg0_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Create kernel error: {}", kernel_error); + logger.error (nano::log::type::opencl_work, "Create kernel error: {}", kernel_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Build program error: {}", clBuildProgramError); + logger.error (nano::log::type::opencl_work, "Build program error: {}", clBuildProgramError); for (auto i (selected_devices.begin ()), n (selected_devices.end ()); i != n; ++i) { std::size_t log_size (0); clGetProgramBuildInfo (program, *i, CL_PROGRAM_BUILD_LOG, 0, nullptr, &log_size); std::vector log (log_size); clGetProgramBuildInfo (program, *i, CL_PROGRAM_BUILD_LOG, log.size (), log.data (), nullptr); - nlogger.info (nano::log::type::opencl_work, "Device log: {}", log.data ()); + logger.info (nano::log::type::opencl_work, "Device log: {}", log.data ()); } } } else { - nlogger.error (nano::log::type::opencl_work, "Create program error: {}", program_error); + logger.error (nano::log::type::opencl_work, "Create program error: {}", program_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Difficulty buffer error: {}", difficulty_error); + logger.error (nano::log::type::opencl_work, "Difficulty buffer error: {}", difficulty_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Item buffer error: {}", item_error); + logger.error (nano::log::type::opencl_work, "Item buffer error: {}", item_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Result buffer error: {}", result_error); + logger.error (nano::log::type::opencl_work, "Result buffer error: {}", result_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Attempt buffer error: {}", attempt_error); + logger.error (nano::log::type::opencl_work, "Attempt buffer error: {}", attempt_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Unable to create command queue: {}", queue_error); + logger.error (nano::log::type::opencl_work, "Unable to create command queue: {}", queue_error); } } else { - nlogger.error (nano::log::type::opencl_work, "Unable to create context: {}", createContextError); + logger.error (nano::log::type::opencl_work, "Unable to create context: {}", createContextError); } } else { - nlogger.error (nano::log::type::opencl_work, "Requested device {} and only have {}", config.device, platform.devices.size ()); + logger.error (nano::log::type::opencl_work, "Requested device {} and only have {}", config.device, platform.devices.size ()); } } else { - nlogger.error (nano::log::type::opencl_work, "Requested platform {} and only have {}", config.platform, environment_a.platforms.size ()); + logger.error (nano::log::type::opencl_work, "Requested platform {} and only have {}", config.platform, environment_a.platforms.size ()); } } @@ -481,37 +481,37 @@ boost::optional nano::opencl_work::generate_work (nano::work_version c else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error finishing queue: {}", finishError); + logger.error (nano::log::type::opencl_work, "Error finishing queue: {}", finishError); } } else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error reading result: {}", read_error1); + logger.error (nano::log::type::opencl_work, "Error reading result: {}", read_error1); } } else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error enqueueing kernel: {}", enqueue_error); + logger.error (nano::log::type::opencl_work, "Error enqueueing kernel: {}", enqueue_error); } } else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error writing difficulty: {}", write_error3); + logger.error (nano::log::type::opencl_work, "Error writing difficulty: {}", write_error3); } } else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error writing item: {}", write_error2); + logger.error (nano::log::type::opencl_work, "Error writing item: {}", write_error2); } } else { error = true; - nlogger.error (nano::log::type::opencl_work, "Error writing attempt: {}", write_error1); + logger.error (nano::log::type::opencl_work, "Error writing attempt: {}", write_error1); } } boost::optional value; @@ -522,7 +522,7 @@ boost::optional nano::opencl_work::generate_work (nano::work_version c return value; } -std::unique_ptr nano::opencl_work::create (bool create_a, nano::opencl_config const & config_a, nano::nlogger & nlogger_a, nano::work_thresholds & work) +std::unique_ptr nano::opencl_work::create (bool create_a, nano::opencl_config const & config_a, nano::logger & logger_a, nano::work_thresholds & work) { std::unique_ptr result; if (create_a) @@ -532,11 +532,11 @@ std::unique_ptr nano::opencl_work::create (bool create_a, nan nano::opencl_environment environment (error); std::stringstream stream; environment.dump (stream); - nlogger_a.info (nano::log::type::opencl_work, "OpenCL environment: {}", stream.str ()); + logger_a.info (nano::log::type::opencl_work, "OpenCL environment: {}", stream.str ()); if (!error) { - result.reset (new nano::opencl_work (error, config_a, environment, nlogger_a, work)); + result.reset (new nano::opencl_work (error, config_a, environment, logger_a, work)); if (error) { result.reset (); diff --git a/nano/node/openclwork.hpp b/nano/node/openclwork.hpp index de76e6e416..15173c1dcc 100644 --- a/nano/node/openclwork.hpp +++ b/nano/node/openclwork.hpp @@ -21,7 +21,7 @@ namespace nano { extern bool opencl_loaded; -class nlogger; +class logger; class opencl_platform { public: @@ -40,11 +40,11 @@ class work_pool; class opencl_work { public: - opencl_work (bool &, nano::opencl_config const &, nano::opencl_environment &, nano::nlogger &, nano::work_thresholds & work); + opencl_work (bool &, nano::opencl_config const &, nano::opencl_environment &, nano::logger &, nano::work_thresholds & work); ~opencl_work (); boost::optional generate_work (nano::work_version const, nano::root const &, uint64_t const); boost::optional generate_work (nano::work_version const, nano::root const &, uint64_t const, std::atomic &); - static std::unique_ptr create (bool, nano::opencl_config const &, nano::nlogger &, nano::work_thresholds & work); + static std::unique_ptr create (bool, nano::opencl_config const &, nano::logger &, nano::work_thresholds & work); nano::opencl_config const & config; nano::mutex mutex; cl_context context; @@ -56,7 +56,7 @@ class opencl_work cl_kernel kernel; cl_command_queue queue; nano::xorshift1024star rand; - nano::nlogger & nlogger; + nano::logger & logger; nano::work_thresholds & work; }; } diff --git a/nano/node/portmapping.cpp b/nano/node/portmapping.cpp index 15a5d08a10..e8d01e847f 100644 --- a/nano/node/portmapping.cpp +++ b/nano/node/portmapping.cpp @@ -62,7 +62,7 @@ void nano::port_mapping::refresh_devices () auto igd_error_l (UPNP_GetValidIGD (upnp_l.devices, &upnp_l.urls, &upnp_l.data, local_address_l.data (), sizeof (local_address_l))); // Bump logging level periodically - node.nlogger.log ((check_count % 15 == 0) ? nano::log::level::info : nano::log::level::debug, + node.logger.log ((check_count % 15 == 0) ? nano::log::level::info : nano::log::level::debug, nano::log::type::upnp, "UPnP local address {}, discovery: {}, IGD search: {}", local_address_l.data (), discover_error_l, @@ -70,7 +70,7 @@ void nano::port_mapping::refresh_devices () for (auto i (upnp_l.devices); i != nullptr; i = i->pNext) { - node.nlogger.debug (nano::log::type::upnp, "UPnP device url: {}, st: {}, usn: {}", i->descURL, i->st, i->usn); + node.logger.debug (nano::log::type::upnp, "UPnP device url: {}, st: {}, usn: {}", i->descURL, i->st, i->usn); } // Update port mapping @@ -117,7 +117,7 @@ void nano::port_mapping::refresh_mapping () { protocol.external_port = static_cast (std::atoi (config_port_l.data ())); - node.nlogger.info (nano::log::type::upnp, "UPnP {} {}:{} mapped to: {}", + node.logger.info (nano::log::type::upnp, "UPnP {} {}:{} mapped to: {}", protocol.name, protocol.external_address.to_string (), config_port_l, @@ -127,7 +127,7 @@ void nano::port_mapping::refresh_mapping () { protocol.external_port = 0; - node.nlogger.warn (nano::log::type::upnp, "UPnP {} {}:{} failed: {} ({})", + node.logger.warn (nano::log::type::upnp, "UPnP {} {}:{} failed: {} ({})", protocol.name, protocol.external_address.to_string (), config_port_l, @@ -161,7 +161,7 @@ bool nano::port_mapping::check_lost_or_old_mapping () { result_l = true; - node.nlogger.warn (nano::log::type::upnp, "UPnP get specific port mapping failed: {} ({})", + node.logger.warn (nano::log::type::upnp, "UPnP get specific port mapping failed: {} ({})", verify_port_mapping_error_l, strupnperror (verify_port_mapping_error_l)); } @@ -169,7 +169,7 @@ bool nano::port_mapping::check_lost_or_old_mapping () { result_l = true; - node.nlogger.info (nano::log::type::upnp, "UPnP lease time getting old, remaining time: {}, lease time: {}, below the threshold: {}", + node.logger.info (nano::log::type::upnp, "UPnP lease time getting old, remaining time: {}, lease time: {}, below the threshold: {}", remaining_from_port_mapping, lease_duration, lease_duration_divided_by_two); @@ -187,12 +187,12 @@ bool nano::port_mapping::check_lost_or_old_mapping () { protocol.external_address = boost::asio::ip::address_v4::any (); - node.nlogger.warn (nano::log::type::upnp, "UPnP get external ip address failed: {} ({})", + node.logger.warn (nano::log::type::upnp, "UPnP get external ip address failed: {} ({})", external_ip_error_l, strupnperror (external_ip_error_l)); } - node.nlogger.debug (nano::log::type::upnp, "UPnP {} mapping verification response: {}, external ip response: {}, external ip: {}, internal ip: {}, remaining lease: {}", + node.logger.debug (nano::log::type::upnp, "UPnP {} mapping verification response: {}, external ip response: {}, external ip: {}, internal ip: {}, remaining lease: {}", protocol.name, verify_port_mapping_error_l, external_ip_error_l, @@ -219,13 +219,13 @@ void nano::port_mapping::check_mapping_loop () } else { - node.nlogger.info (nano::log::type::upnp, "UPnP No need to refresh the mapping"); + node.logger.info (nano::log::type::upnp, "UPnP No need to refresh the mapping"); } } else { // Bump logging level periodically - node.nlogger.log ((check_count % 15 == 0) ? nano::log::level::info : nano::log::level::debug, + node.logger.log ((check_count % 15 == 0) ? nano::log::level::info : nano::log::level::debug, nano::log::type::upnp, "UPnP No IGD devices found"); } @@ -249,14 +249,14 @@ void nano::port_mapping::stop () auto delete_error_l (UPNP_DeletePortMapping (upnp.urls.controlURL, upnp.data.first.servicetype, std::to_string (protocol.external_port).c_str (), protocol.name, address.to_string ().c_str ())); if (delete_error_l) { - node.nlogger.warn (nano::log::type::upnp, "UPnP shutdown {} port mapping failed: {} ({})", + node.logger.warn (nano::log::type::upnp, "UPnP shutdown {} port mapping failed: {} ({})", protocol.name, delete_error_l, strupnperror (delete_error_l)); } else { - node.nlogger.info (nano::log::type::upnp, "UPnP shutdown {} port mapping successful: {}:{}", + node.logger.info (nano::log::type::upnp, "UPnP shutdown {} port mapping successful: {}:{}", protocol.name, protocol.external_address.to_string (), protocol.external_port); diff --git a/nano/node/repcrawler.cpp b/nano/node/repcrawler.cpp index 3c8b251896..8d7bb5ceee 100644 --- a/nano/node/repcrawler.cpp +++ b/nano/node/repcrawler.cpp @@ -45,7 +45,7 @@ void nano::rep_crawler::validate () if (channel->get_type () == nano::transport::transport_type::loopback) { - node.nlogger.debug (nano::log::type::repcrawler, "Ignoring vote from loopback channel: {}", channel->to_string ()); + node.logger.debug (nano::log::type::repcrawler, "Ignoring vote from loopback channel: {}", channel->to_string ()); continue; } @@ -53,7 +53,7 @@ void nano::rep_crawler::validate () nano::uint128_t rep_weight = node.ledger.weight (vote->account); if (rep_weight < minimum) { - node.nlogger.debug (nano::log::type::repcrawler, "Ignoring vote from account {} with too little voting weight: {}", + node.logger.debug (nano::log::type::repcrawler, "Ignoring vote from account {} with too little voting weight: {}", vote->account.to_account (), nano::util::to_str (rep_weight)); @@ -93,11 +93,11 @@ void nano::rep_crawler::validate () if (inserted) { - node.nlogger.info (nano::log::type::repcrawler, "Found representative {} at {}", vote->account.to_account (), channel->to_string ()); + node.logger.info (nano::log::type::repcrawler, "Found representative {} at {}", vote->account.to_account (), channel->to_string ()); } if (updated) { - node.nlogger.warn (nano::log::type::repcrawler, "Updated representative {} at {} (was at: {})", vote->account.to_account (), channel->to_string (), prev_channel->to_string ()); + node.logger.warn (nano::log::type::repcrawler, "Updated representative {} at {} (was at: {})", vote->account.to_account (), channel->to_string (), prev_channel->to_string ()); } } } diff --git a/nano/node/transport/socket.cpp b/nano/node/transport/socket.cpp index 11b2957f22..609bb75220 100644 --- a/nano/node/transport/socket.cpp +++ b/nano/node/transport/socket.cpp @@ -260,7 +260,7 @@ void nano::transport::socket::ongoing_checkup () if (condition_to_disconnect) { - this_l->node.nlogger.debug (nano::log::type::tcp_server, "Closing socket due to timeout ({})", nano::util::to_str (this_l->remote)); + this_l->node.logger.debug (nano::log::type::tcp_server, "Closing socket due to timeout ({})", nano::util::to_str (this_l->remote)); this_l->timed_out = true; this_l->close (); @@ -335,7 +335,7 @@ void nano::transport::socket::close_internal () if (ec) { node.stats.inc (nano::stat::type::socket, nano::stat::detail::error_socket_close); - node.nlogger.error (nano::log::type::socket, "Failed to close socket gracefully: {} ({})", ec.message (), nano::util::to_str (remote)); + node.logger.error (nano::log::type::socket, "Failed to close socket gracefully: {} ({})", ec.message (), nano::util::to_str (remote)); } } diff --git a/nano/node/transport/tcp.cpp b/nano/node/transport/tcp.cpp index b1e42c4f21..25fd21a5ba 100644 --- a/nano/node/transport/tcp.cpp +++ b/nano/node/transport/tcp.cpp @@ -555,7 +555,7 @@ void nano::transport::tcp_channels::start_tcp (nano::endpoint const & endpoint_a auto query = node_l->network.prepare_handshake_query (endpoint_a); nano::node_id_handshake message{ node_l->network_params.network, query }; - node_l->nlogger.debug (nano::log::type::tcp, "Handshake sent to: {} (query: {})", + node_l->logger.debug (nano::log::type::tcp, "Handshake sent to: {} (query: {})", nano::util::to_str (endpoint_a), (query ? query->cookie.to_string () : "")); @@ -571,7 +571,7 @@ void nano::transport::tcp_channels::start_tcp (nano::endpoint const & endpoint_a } else { - node_l->nlogger.debug (nano::log::type::tcp, "Error sending handshake to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error sending handshake to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); if (auto socket_l = channel->socket.lock ()) { @@ -585,11 +585,11 @@ void nano::transport::tcp_channels::start_tcp (nano::endpoint const & endpoint_a { if (ec) { - node_l->nlogger.debug (nano::log::type::tcp, "Error connecting to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error connecting to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); } else { - node_l->nlogger.debug (nano::log::type::tcp, "Error connecting to: {}", nano::util::to_str (endpoint_a)); + node_l->logger.debug (nano::log::type::tcp, "Error connecting to: {}", nano::util::to_str (endpoint_a)); } } } @@ -627,7 +627,7 @@ void nano::transport::tcp_channels::start_tcp_receive_node_id (std::shared_ptrnlogger.debug (nano::log::type::tcp, "Error reading handshake from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error reading handshake from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); cleanup_node_id_handshake_socket (endpoint_a); return; @@ -638,7 +638,7 @@ void nano::transport::tcp_channels::start_tcp_receive_node_id (std::shared_ptrtype () != nano::message_type::node_id_handshake) { - node_l->nlogger.debug (nano::log::type::tcp, "Error reading handshake header from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error reading handshake header from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); cleanup_node_id_handshake_socket (endpoint_a); return; @@ -668,7 +668,7 @@ void nano::transport::tcp_channels::start_tcp_receive_node_id (std::shared_ptrnlogger.debug (nano::log::type::tcp, "Error reading handshake payload from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error reading handshake payload from: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); cleanup_node_id_handshake_socket (endpoint_a); return; @@ -702,7 +702,7 @@ void nano::transport::tcp_channels::start_tcp_receive_node_id (std::shared_ptrnetwork.prepare_handshake_response (*handshake.query, handshake.is_v2 ()); nano::node_id_handshake handshake_response (node_l->network_params.network, std::nullopt, response); - node_l->nlogger.debug (nano::log::type::tcp, "Handshake response sent to {} (query: {})", + node_l->logger.debug (nano::log::type::tcp, "Handshake response sent to {} (query: {})", nano::util::to_str (endpoint_a), handshake.query->cookie.to_string ()); @@ -714,7 +714,7 @@ void nano::transport::tcp_channels::start_tcp_receive_node_id (std::shared_ptrnlogger.debug (nano::log::type::tcp, "Error sending handshake response to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); + node_l->logger.debug (nano::log::type::tcp, "Error sending handshake response to: {} ({})", nano::util::to_str (endpoint_a), ec.message ()); cleanup_node_id_handshake_socket (endpoint_a); return; diff --git a/nano/node/transport/tcp_server.cpp b/nano/node/transport/tcp_server.cpp index 83dfef4924..9d02482b11 100644 --- a/nano/node/transport/tcp_server.cpp +++ b/nano/node/transport/tcp_server.cpp @@ -56,7 +56,7 @@ void nano::transport::tcp_listener::start (std::functionacceptor.is_open ()) { - this_l->node.nlogger.error (nano::log::type::tcp_listener, "Acceptor is not open"); + this_l->node.logger.error (nano::log::type::tcp_listener, "Acceptor is not open"); return; } @@ -139,7 +139,7 @@ void nano::transport::tcp_listener::on_connection (std::functionconnections_per_address.size () >= this_l->max_inbound_connections) { this_l->node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_accept_failure, nano::stat::dir::in); - this_l->node.nlogger.debug (nano::log::type::tcp_listener, "Max connections reached ({}), unable to open new connection", this_l->connections_per_address.size ()); + this_l->node.logger.debug (nano::log::type::tcp_listener, "Max connections reached ({}), unable to open new connection", this_l->connections_per_address.size ()); this_l->on_connection_requeue_delayed (std::move (cbk)); return; @@ -148,7 +148,7 @@ void nano::transport::tcp_listener::on_connection (std::functionlimit_reached_for_incoming_ip_connections (new_connection)) { this_l->node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::in); - this_l->node.nlogger.debug (nano::log::type::tcp_listener, "Max connections per IP reached ({}), unable to open new connection", new_connection->remote_endpoint ().address ().to_string ()); + this_l->node.logger.debug (nano::log::type::tcp_listener, "Max connections per IP reached ({}), unable to open new connection", new_connection->remote_endpoint ().address ().to_string ()); this_l->on_connection_requeue_delayed (std::move (cbk)); return; @@ -161,7 +161,7 @@ void nano::transport::tcp_listener::on_connection (std::functionnode.network_params.network.max_peers_per_subnetwork); this_l->node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::in); - this_l->node.nlogger.debug (nano::log::type::tcp_listener, "Max connections per subnetwork reached (subnetwork: {}, ip: {}), unable to open new connection", + this_l->node.logger.debug (nano::log::type::tcp_listener, "Max connections per subnetwork reached (subnetwork: {}, ip: {}), unable to open new connection", remote_subnet.canonical ().to_string (), remote_ip_address.to_string ()); @@ -189,13 +189,13 @@ void nano::transport::tcp_listener::on_connection (std::functionon_connection (std::move (cbk)); return; } - this_l->node.nlogger.warn (nano::log::type::tcp_listener, "Stopping to accept new connections"); + this_l->node.logger.warn (nano::log::type::tcp_listener, "Stopping to accept new connections"); return; } // accept error this_l->node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_accept_failure, nano::stat::dir::in); - this_l->node.nlogger.error (nano::log::type::tcp_listener, "Unable to accept connection: {} ({})", ec_a.message (), new_connection->remote_endpoint ().address ().to_string ()); + this_l->node.logger.error (nano::log::type::tcp_listener, "Unable to accept connection: {} ({})", ec_a.message (), new_connection->remote_endpoint ().address ().to_string ()); if (is_temporary_error (ec_a)) { @@ -212,7 +212,7 @@ void nano::transport::tcp_listener::on_connection (std::functionnode.nlogger.warn (nano::log::type::tcp_listener, "Stopping to accept new connections"); + this_l->node.logger.warn (nano::log::type::tcp_listener, "Stopping to accept new connections"); })); })); } @@ -254,7 +254,7 @@ void nano::transport::tcp_listener::accept_action (boost::system::error_code con else { node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_excluded); - node.nlogger.debug (nano::log::type::tcp_server, "Rejected connection from excluded peer: {}", nano::util::to_str (socket_a->remote_endpoint ())); + node.logger.debug (nano::log::type::tcp_server, "Rejected connection from excluded peer: {}", nano::util::to_str (socket_a->remote_endpoint ())); } } @@ -306,7 +306,7 @@ nano::transport::tcp_server::~tcp_server () return; } - node->nlogger.debug (nano::log::type::tcp_server, "Exiting TCP server ({})", nano::util::to_str (remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Exiting TCP server ({})", nano::util::to_str (remote_endpoint)); if (socket->type () == nano::transport::socket::type_t::bootstrap) { @@ -342,7 +342,7 @@ void nano::transport::tcp_server::start () if (auto node_l = node.lock (); node_l) { - node_l->nlogger.debug (nano::log::type::tcp_server, "Starting TCP server ({})", nano::util::to_str (remote_endpoint)); + node_l->logger.debug (nano::log::type::tcp_server, "Starting TCP server ({})", nano::util::to_str (remote_endpoint)); } receive_message (); @@ -373,7 +373,7 @@ void nano::transport::tcp_server::receive_message () { // IO error or critical error when deserializing message node->stats.inc (nano::stat::type::error, nano::to_stat_detail (this_l->message_deserializer->status)); - node->nlogger.debug (nano::log::type::tcp_server, "Error reading message: {}, status: {} ({})", + node->logger.debug (nano::log::type::tcp_server, "Error reading message: {}, status: {} ({})", ec.message (), nano::to_string (this_l->message_deserializer->status), nano::util::to_str (this_l->remote_endpoint)); @@ -412,7 +412,7 @@ void nano::transport::tcp_server::received_message (std::unique_ptrnlogger.debug (nano::log::type::tcp_server, "Error deserializing message: {} ({})", + node->logger.debug (nano::log::type::tcp_server, "Error deserializing message: {} ({})", nano::to_string (message_deserializer->status), nano::util::to_str (remote_endpoint)); } @@ -466,7 +466,7 @@ bool nano::transport::tcp_server::process_message (std::unique_ptrnlogger.debug (nano::log::type::tcp_server, "Neither handshake nor bootstrap received when in handshake mode: {} ({})", + node->logger.debug (nano::log::type::tcp_server, "Neither handshake nor bootstrap received when in handshake mode: {} ({})", nano::to_string (message->header.type), nano::util::to_str (remote_endpoint)); @@ -522,7 +522,7 @@ void nano::transport::tcp_server::handshake_message_visitor::node_id_handshake ( } if (node->flags.disable_tcp_realtime) { - node->nlogger.debug (nano::log::type::tcp_server, "Handshake attempted with disabled realtime TCP ({})", nano::util::to_str (server->remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Handshake attempted with disabled realtime TCP ({})", nano::util::to_str (server->remote_endpoint)); // Stop invalid handshake server->stop (); @@ -531,7 +531,7 @@ void nano::transport::tcp_server::handshake_message_visitor::node_id_handshake ( if (message.query && server->handshake_query_received) { - node->nlogger.debug (nano::log::type::tcp_server, "Detected multiple handshake queries ({})", nano::util::to_str (server->remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Detected multiple handshake queries ({})", nano::util::to_str (server->remote_endpoint)); // Stop invalid handshake server->stop (); @@ -540,7 +540,7 @@ void nano::transport::tcp_server::handshake_message_visitor::node_id_handshake ( server->handshake_query_received = true; - node->nlogger.debug (nano::log::type::tcp_server, "Handshake query received ({})", nano::util::to_str (server->remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Handshake query received ({})", nano::util::to_str (server->remote_endpoint)); if (message.query) { @@ -584,7 +584,7 @@ void nano::transport::tcp_server::send_handshake_response (nano::node_id_handsha } if (ec) { - node->nlogger.debug (nano::log::type::tcp_server, "Error sending handshake response: {} ({})", ec.message (), nano::util::to_str (this_l->remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Error sending handshake response: {} ({})", ec.message (), nano::util::to_str (this_l->remote_endpoint)); // Stop invalid handshake this_l->stop (); @@ -781,7 +781,7 @@ void nano::transport::tcp_server::timeout () } if (socket->has_timed_out ()) { - node->nlogger.debug (nano::log::type::tcp_server, "Closing TCP server due to timeout ({})", nano::util::to_str (remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Closing TCP server due to timeout ({})", nano::util::to_str (remote_endpoint)); { nano::lock_guard lock{ node->tcp_listener->mutex }; @@ -818,7 +818,7 @@ bool nano::transport::tcp_server::to_bootstrap_connection () ++node->tcp_listener->bootstrap_count; socket->type_set (nano::transport::socket::type_t::bootstrap); - node->nlogger.debug (nano::log::type::tcp_server, "Switched to bootstrap mode ({})", nano::util::to_str (remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Switched to bootstrap mode ({})", nano::util::to_str (remote_endpoint)); return true; } @@ -836,7 +836,7 @@ bool nano::transport::tcp_server::to_realtime_connection (nano::account const & ++node->tcp_listener->realtime_count; socket->type_set (nano::transport::socket::type_t::realtime); - node->nlogger.debug (nano::log::type::tcp_server, "Switched to realtime mode ({})", nano::util::to_str (remote_endpoint)); + node->logger.debug (nano::log::type::tcp_server, "Switched to realtime mode ({})", nano::util::to_str (remote_endpoint)); return true; } diff --git a/nano/node/vote_processor.cpp b/nano/node/vote_processor.cpp index 522cba1aba..0885da8332 100644 --- a/nano/node/vote_processor.cpp +++ b/nano/node/vote_processor.cpp @@ -15,12 +15,12 @@ #include using namespace std::chrono_literals; -nano::vote_processor::vote_processor (nano::active_transactions & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_config & config_a, nano::node_flags & flags_a, nano::nlogger & nlogger_a, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a) : +nano::vote_processor::vote_processor (nano::active_transactions & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_config & config_a, nano::node_flags & flags_a, nano::logger & logger_a, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a) : active (active_a), observers (observers_a), stats (stats_a), config (config_a), - nlogger (nlogger_a), + logger (logger_a), online_reps (online_reps_a), rep_crawler (rep_crawler_a), ledger (ledger_a), @@ -77,7 +77,7 @@ void nano::vote_processor::process_loop () if (log_this_iteration && elapsed.stop () > std::chrono::milliseconds (100)) { - nlogger.debug (nano::log::type::vote_processor, "Processed {} votes in {} milliseconds (rate of {} votes per second)", + logger.debug (nano::log::type::vote_processor, "Processed {} votes in {} milliseconds (rate of {} votes per second)", votes_l.size (), elapsed.value ().count (), ((votes_l.size () * 1000ULL) / elapsed.value ().count ())); @@ -199,7 +199,7 @@ void nano::vote_processor::flush () }); if (!success) { - nlogger.error (nano::log::type::vote_processor, "Flush timeout"); + logger.error (nano::log::type::vote_processor, "Flush timeout"); debug_assert (false && "vote_processor::flush timeout while waiting for flush"); } } diff --git a/nano/node/vote_processor.hpp b/nano/node/vote_processor.hpp index 6ae37d16b2..dbcacc41c3 100644 --- a/nano/node/vote_processor.hpp +++ b/nano/node/vote_processor.hpp @@ -20,7 +20,7 @@ namespace store class node_observers; class stats; class node_config; -class nlogger; +class logger; class online_reps; class rep_crawler; class ledger; @@ -36,7 +36,7 @@ namespace transport class vote_processor final { public: - vote_processor (nano::active_transactions & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_config & config_a, nano::node_flags & flags_a, nano::nlogger &, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a); + vote_processor (nano::active_transactions & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_config & config_a, nano::node_flags & flags_a, nano::logger &, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a); /** Returns false if the vote was processed */ bool vote (std::shared_ptr const &, std::shared_ptr const &); @@ -60,7 +60,7 @@ class vote_processor final nano::node_observers & observers; nano::stats & stats; nano::node_config & config; - nano::nlogger & nlogger; + nano::logger & logger; nano::online_reps & online_reps; nano::rep_crawler & rep_crawler; nano::ledger & ledger; diff --git a/nano/node/wallet.cpp b/nano/node/wallet.cpp index 6ce77661ed..3f29a80a0e 100644 --- a/nano/node/wallet.cpp +++ b/nano/node/wallet.cpp @@ -699,7 +699,7 @@ bool nano::wallet::enter_password (store::transaction const & transaction_a, std auto result (store.attempt_password (transaction_a, password_a)); if (!result) { - wallets.node.nlogger.info (nano::log::type::wallet, "Wallet unlocked"); + wallets.node.logger.info (nano::log::type::wallet, "Wallet unlocked"); auto this_l = shared_from_this (); wallets.node.wallets.queue_wallet_action (nano::wallets::high_priority, this_l, [this_l] (nano::wallet & wallet) { @@ -709,7 +709,7 @@ bool nano::wallet::enter_password (store::transaction const & transaction_a, std } else { - wallets.node.nlogger.warn (nano::log::type::wallet, "Invalid password, wallet locked"); + wallets.node.logger.warn (nano::log::type::wallet, "Invalid password, wallet locked"); } lock_observer (result, password_a.empty ()); return result; @@ -866,7 +866,7 @@ std::shared_ptr nano::wallet::receive_action (nano::block_hash cons } else { - wallets.node.nlogger.warn (nano::log::type::wallet, "Unable to receive, wallet locked"); + wallets.node.logger.warn (nano::log::type::wallet, "Unable to receive, wallet locked"); } } else @@ -882,7 +882,7 @@ std::shared_ptr nano::wallet::receive_action (nano::block_hash cons else { // Someone sent us something below the threshold of receiving - wallets.node.nlogger.warn (nano::log::type::wallet, "Not receiving block {} due to minimum receive threshold", send_hash_a.to_string ()); + wallets.node.logger.warn (nano::log::type::wallet, "Not receiving block {} due to minimum receive threshold", send_hash_a.to_string ()); } if (block != nullptr) { @@ -1044,7 +1044,7 @@ bool nano::wallet::action_complete (std::shared_ptr const & block_a auto required_difficulty{ wallets.node.network_params.work.threshold (block_a->work_version (), details_a) }; if (wallets.node.network_params.work.difficulty (*block_a) < required_difficulty) { - wallets.node.nlogger.info (nano::log::type::wallet, "Cached or provided work for block {} account {} is invalid, regenerating...", + wallets.node.logger.info (nano::log::type::wallet, "Cached or provided work for block {} account {} is invalid, regenerating...", block_a->hash ().to_string (), account_a.to_account ()); @@ -1143,7 +1143,7 @@ void nano::wallet::work_update (store::transaction const & transaction_a, nano:: } else { - wallets.node.nlogger.warn (nano::log::type::wallet, "Cached work no longer valid, discarding"); + wallets.node.logger.warn (nano::log::type::wallet, "Cached work no longer valid, discarding"); } } @@ -1172,7 +1172,7 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact auto result (!store.valid_password (wallet_transaction_a)); if (!result) { - wallets.node.nlogger.info (nano::log::type::wallet, "Beginning receivable block search"); + wallets.node.logger.info (nano::log::type::wallet, "Beginning receivable block search"); for (auto i (store.begin (wallet_transaction_a)), n (store.end ()); i != n; ++i) { @@ -1189,7 +1189,7 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact auto amount (pending.amount.number ()); if (wallets.node.config.receive_minimum.number () <= amount) { - wallets.node.nlogger.info (nano::log::type::wallet, "Found a receivable block {} for account {}", hash.to_string (), pending.source.to_account ()); + wallets.node.logger.info (nano::log::type::wallet, "Found a receivable block {} for account {}", hash.to_string (), pending.source.to_account ()); if (wallets.node.ledger.block_confirmed (block_transaction, hash)) { @@ -1211,11 +1211,11 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact } } - wallets.node.nlogger.info (nano::log::type::wallet, "Receivable block search phase complete"); + wallets.node.logger.info (nano::log::type::wallet, "Receivable block search phase complete"); } else { - wallets.node.nlogger.warn (nano::log::type::wallet, "Stopping search, wallet is locked"); + wallets.node.logger.warn (nano::log::type::wallet, "Stopping search, wallet is locked"); } return result; } @@ -1307,7 +1307,7 @@ void nano::wallet::work_cache_blocking (nano::account const & account_a, nano::r } else if (!wallets.node.stopped) { - wallets.node.nlogger.warn (nano::log::type::wallet, "Could not precache work for root {} due to work generation failure", root_a.to_string ()); + wallets.node.logger.warn (nano::log::type::wallet, "Could not precache work for root {} due to work generation failure", root_a.to_string ()); } } } @@ -1395,7 +1395,7 @@ nano::wallets::wallets (bool error_a, nano::node & node_a) : char const * store_path; mdb_env_get_path (env, &store_path); std::filesystem::path const path (store_path); - nano::store::lmdb::component::create_backup_file (env, path, node_a.nlogger); + nano::store::lmdb::component::create_backup_file (env, path, node_a.logger); } for (auto & item : items) { @@ -1569,7 +1569,7 @@ void nano::wallets::foreach_representative (std::functionfirst.to_string ()); + node.logger.warn (nano::log::type::wallet, "Representative locked inside wallet: {}", i->first.to_string ()); } } } diff --git a/nano/node/websocket.cpp b/nano/node/websocket.cpp index a58a2a5247..c2b3af2f98 100644 --- a/nano/node/websocket.cpp +++ b/nano/node/websocket.cpp @@ -15,15 +15,15 @@ #include #include -nano::websocket::confirmation_options::confirmation_options (nano::wallets & wallets_a, nano::nlogger & nlogger_a) : +nano::websocket::confirmation_options::confirmation_options (nano::wallets & wallets_a, nano::logger & logger_a) : wallets (wallets_a), - nlogger (nlogger_a) + logger (logger_a) { } -nano::websocket::confirmation_options::confirmation_options (boost::property_tree::ptree const & options_a, nano::wallets & wallets_a, nano::nlogger & nlogger_a) : +nano::websocket::confirmation_options::confirmation_options (boost::property_tree::ptree const & options_a, nano::wallets & wallets_a, nano::logger & logger_a) : wallets (wallets_a), - nlogger (nlogger_a) + logger (logger_a) { // Non-account filtering options include_block = options_a.get ("include_block", true); @@ -64,7 +64,7 @@ nano::websocket::confirmation_options::confirmation_options (boost::property_tre if (!include_block) { - nlogger.warn (nano::log::type::websocket, "Filtering option \"all_local_accounts\" requires that \"include_block\" is set to true to be effective"); + logger.warn (nano::log::type::websocket, "Filtering option \"all_local_accounts\" requires that \"include_block\" is set to true to be effective"); } } auto accounts_l (options_a.get_child_optional ("accounts")); @@ -81,13 +81,13 @@ nano::websocket::confirmation_options::confirmation_options (boost::property_tre } else { - nlogger.warn (nano::log::type::websocket, "Invalid account provided for filtering blocks: ", account_l.second.data ()); + logger.warn (nano::log::type::websocket, "Invalid account provided for filtering blocks: ", account_l.second.data ()); } } if (!include_block) { - nlogger.warn (nano::log::type::websocket, "Filtering option \"accounts\" requires that \"include_block\" is set to true to be effective"); + logger.warn (nano::log::type::websocket, "Filtering option \"accounts\" requires that \"include_block\" is set to true to be effective"); } } check_filter_empty (); @@ -162,7 +162,7 @@ bool nano::websocket::confirmation_options::update (boost::property_tree::ptree } else { - nlogger.warn (nano::log::type::websocket, "Invalid account provided for filtering blocks: ", account_l.second.data ()); + logger.warn (nano::log::type::websocket, "Invalid account provided for filtering blocks: ", account_l.second.data ()); } } }; @@ -190,11 +190,11 @@ void nano::websocket::confirmation_options::check_filter_empty () const // Warn the user if the options resulted in an empty filter if (has_account_filtering_options && !all_local_accounts && accounts.empty ()) { - nlogger.warn (nano::log::type::websocket, "Provided options resulted in an empty account confirmation filter"); + logger.warn (nano::log::type::websocket, "Provided options resulted in an empty account confirmation filter"); } } -nano::websocket::vote_options::vote_options (boost::property_tree::ptree const & options_a, nano::nlogger & nlogger) +nano::websocket::vote_options::vote_options (boost::property_tree::ptree const & options_a, nano::logger & logger) { include_replays = options_a.get ("include_replays", false); include_indeterminate = options_a.get ("include_indeterminate", false); @@ -211,13 +211,13 @@ nano::websocket::vote_options::vote_options (boost::property_tree::ptree const & } else { - nlogger.warn (nano::log::type::websocket, "Invalid account provided for filtering votes: ", representative_l.second.data ()); + logger.warn (nano::log::type::websocket, "Invalid account provided for filtering votes: ", representative_l.second.data ()); } } // Warn the user if the option will be ignored if (representatives.empty ()) { - nlogger.warn (nano::log::type::websocket, "Account filter for votes is empty, no messages will be filtered"); + logger.warn (nano::log::type::websocket, "Account filter for votes is empty, no messages will be filtered"); } } } @@ -246,10 +246,10 @@ nano::websocket::session::session (nano::websocket::listener & listener_a, socke #endif -nano::websocket::session::session (nano::websocket::listener & listener_a, socket_type socket_a, nano::nlogger & nlogger_a) : +nano::websocket::session::session (nano::websocket::listener & listener_a, socket_type socket_a, nano::logger & logger_a) : ws_listener (listener_a), ws (std::move (socket_a)), - nlogger (nlogger_a) + logger (logger_a) { { // Best effort attempt to get endpoint addresses @@ -260,7 +260,7 @@ nano::websocket::session::session (nano::websocket::listener & listener_a, socke debug_assert (!ec); } - nlogger.info (nano::log::type::websocket, "Session started ({})", nano::util::to_str (remote)); + logger.info (nano::log::type::websocket, "Session started ({})", nano::util::to_str (remote)); } nano::websocket::session::~session () @@ -285,14 +285,14 @@ void nano::websocket::session::handshake () } else { - this_l->nlogger.error (nano::log::type::websocket, "Handshake failed: {} ({})", ec.message (), nano::util::to_str (this_l->remote)); + this_l->logger.error (nano::log::type::websocket, "Handshake failed: {} ({})", ec.message (), nano::util::to_str (this_l->remote)); } }); } void nano::websocket::session::close () { - nlogger.info (nano::log::type::websocket, "Session closing ({})", nano::util::to_str (remote)); + logger.info (nano::log::type::websocket, "Session closing ({})", nano::util::to_str (remote)); auto this_l (shared_from_this ()); boost::asio::dispatch (ws.get_strand (), @@ -368,12 +368,12 @@ void nano::websocket::session::read () } catch (boost::property_tree::json_parser::json_parser_error const & ex) { - this_l->nlogger.error (nano::log::type::websocket, "JSON parsing failed: {} ({})", ex.what (), nano::util::to_str (this_l->remote)); + this_l->logger.error (nano::log::type::websocket, "JSON parsing failed: {} ({})", ex.what (), nano::util::to_str (this_l->remote)); } } else if (ec != boost::asio::error::eof) { - this_l->nlogger.error (nano::log::type::websocket, "Read failed: {} ({})", ec.message (), nano::util::to_str (this_l->remote)); + this_l->logger.error (nano::log::type::websocket, "Read failed: {} ({})", ec.message (), nano::util::to_str (this_l->remote)); } }); }); @@ -495,11 +495,11 @@ void nano::websocket::session::handle_message (boost::property_tree::ptree const std::unique_ptr options_l{ nullptr }; if (options_text_l && topic_l == nano::websocket::topic::confirmation) { - options_l = std::make_unique (options_text_l.get (), ws_listener.get_wallets (), nlogger); + options_l = std::make_unique (options_text_l.get (), ws_listener.get_wallets (), logger); } else if (options_text_l && topic_l == nano::websocket::topic::vote) { - options_l = std::make_unique (options_text_l.get (), nlogger); + options_l = std::make_unique (options_text_l.get (), logger); } else { @@ -508,13 +508,13 @@ void nano::websocket::session::handle_message (boost::property_tree::ptree const auto existing (subscriptions.find (topic_l)); if (existing != subscriptions.end ()) { - nlogger.info (nano::log::type::websocket, "Updated subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); + logger.info (nano::log::type::websocket, "Updated subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); existing->second = std::move (options_l); } else { - nlogger.info (nano::log::type::websocket, "New subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); + logger.info (nano::log::type::websocket, "New subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); subscriptions.emplace (topic_l, std::move (options_l)); ws_listener.increase_subscriber_count (topic_l); @@ -539,7 +539,7 @@ void nano::websocket::session::handle_message (boost::property_tree::ptree const nano::lock_guard lk (subscriptions_mutex); if (subscriptions.erase (topic_l)) { - nlogger.info (nano::log::type::websocket, "Removed subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); + logger.info (nano::log::type::websocket, "Removed subscription to topic: {} ({})", from_topic (topic_l), nano::util::to_str (remote)); ws_listener.decrease_subscriber_count (topic_l); } @@ -574,9 +574,9 @@ void nano::websocket::listener::stop () sessions.clear (); } -nano::websocket::listener::listener (std::shared_ptr const & tls_config_a, nano::nlogger & nlogger_a, nano::wallets & wallets_a, boost::asio::io_context & io_ctx_a, boost::asio::ip::tcp::endpoint endpoint_a) : +nano::websocket::listener::listener (std::shared_ptr const & tls_config_a, nano::logger & logger_a, nano::wallets & wallets_a, boost::asio::io_context & io_ctx_a, boost::asio::ip::tcp::endpoint endpoint_a) : tls_config (tls_config_a), - nlogger (nlogger_a), + logger (logger_a), wallets (wallets_a), acceptor (io_ctx_a), socket (io_ctx_a) @@ -594,7 +594,7 @@ nano::websocket::listener::listener (std::shared_ptr const & t } catch (std::exception const & ex) { - nlogger.error (nano::log::type::websocket, "Listen failed: {}", ex.what ()); + logger.error (nano::log::type::websocket, "Listen failed: {}", ex.what ()); } } @@ -619,7 +619,7 @@ void nano::websocket::listener::on_accept (boost::system::error_code ec) { if (ec) { - nlogger.error (nano::log::type::websocket, "Accept failed: {}", ec.message ()); + logger.error (nano::log::type::websocket, "Accept failed: {}", ec.message ()); } else { @@ -633,7 +633,7 @@ void nano::websocket::listener::on_accept (boost::system::error_code ec) } else { - session = std::make_shared (*this, std::move (socket), nlogger); + session = std::make_shared (*this, std::move (socket), logger); } sessions_mutex.lock (); @@ -665,7 +665,7 @@ void nano::websocket::listener::broadcast_confirmation (std::shared_ptrsubscriptions.find (nano::websocket::topic::confirmation)); if (subscription != session_ptr->subscriptions.end ()) { - nano::websocket::confirmation_options default_options (wallets, nlogger); + nano::websocket::confirmation_options default_options (wallets, logger); auto conf_options (dynamic_cast (subscription->second.get ())); if (conf_options == nullptr) { @@ -982,13 +982,13 @@ std::string nano::websocket::message::to_string () const * websocket_server */ -nano::websocket_server::websocket_server (nano::websocket::config & config_a, nano::node_observers & observers_a, nano::wallets & wallets_a, nano::ledger & ledger_a, boost::asio::io_context & io_ctx_a, nano::nlogger & nlogger_a) : +nano::websocket_server::websocket_server (nano::websocket::config & config_a, nano::node_observers & observers_a, nano::wallets & wallets_a, nano::ledger & ledger_a, boost::asio::io_context & io_ctx_a, nano::logger & logger_a) : config{ config_a }, observers{ observers_a }, wallets{ wallets_a }, ledger{ ledger_a }, io_ctx{ io_ctx_a }, - nlogger{ nlogger_a } + logger{ logger_a } { if (!config.enabled) { @@ -996,7 +996,7 @@ nano::websocket_server::websocket_server (nano::websocket::config & config_a, na } auto endpoint = nano::tcp_endpoint{ boost::asio::ip::make_address_v6 (config.address), config.port }; - server = std::make_shared (config.tls_config, nlogger, wallets, io_ctx, endpoint); + server = std::make_shared (config.tls_config, logger, wallets, io_ctx, endpoint); observers.blocks.add ([this] (nano::election_status const & status_a, std::vector const & votes_a, nano::account const & account_a, nano::amount const & amount_a, bool is_state_send_a, bool is_state_epoch_a) { debug_assert (status_a.type != nano::election_status_type::ongoing); diff --git a/nano/node/websocket.hpp b/nano/node/websocket.hpp index 84fdf60c8d..6bb7426a0b 100644 --- a/nano/node/websocket.hpp +++ b/nano/node/websocket.hpp @@ -21,7 +21,7 @@ namespace nano { class wallets; -class nlogger; +class logger; class vote; class election_status; class telemetry_data; @@ -142,8 +142,8 @@ namespace websocket class confirmation_options final : public options { public: - confirmation_options (nano::wallets & wallets_a, nano::nlogger &); - confirmation_options (boost::property_tree::ptree const & options_a, nano::wallets & wallets_a, nano::nlogger &); + confirmation_options (nano::wallets & wallets_a, nano::logger &); + confirmation_options (boost::property_tree::ptree const & options_a, nano::wallets & wallets_a, nano::logger &); /** * Checks if a message should be filtered for given block confirmation options. @@ -195,7 +195,7 @@ namespace websocket void check_filter_empty () const; nano::wallets & wallets; - nano::nlogger & nlogger; + nano::logger & logger; bool include_election_info{ false }; bool include_election_info_with_votes{ false }; @@ -215,7 +215,7 @@ namespace websocket class vote_options final : public options { public: - vote_options (boost::property_tree::ptree const & options_a, nano::nlogger &); + vote_options (boost::property_tree::ptree const & options_a, nano::logger &); /** * Checks if a message should be filtered for given vote received options. @@ -241,7 +241,7 @@ namespace websocket explicit session (nano::websocket::listener & listener_a, socket_type socket_a, boost::asio::ssl::context & ctx_a); #endif /** Constructor that takes ownership over \p socket_a */ - explicit session (nano::websocket::listener & listener_a, socket_type socket_a, nano::nlogger &); + explicit session (nano::websocket::listener & listener_a, socket_type socket_a, nano::logger &); ~session (); @@ -262,7 +262,7 @@ namespace websocket nano::websocket::listener & ws_listener; /** Websocket stream, supporting both plain and tls connections */ nano::websocket::stream ws; - nano::nlogger & nlogger; + nano::logger & logger; /** Buffer for received messages */ boost::beast::multi_buffer read_buffer; @@ -298,7 +298,7 @@ namespace websocket class listener final : public std::enable_shared_from_this { public: - listener (std::shared_ptr const & tls_config_a, nano::nlogger &, nano::wallets & wallets_a, boost::asio::io_context & io_ctx_a, boost::asio::ip::tcp::endpoint endpoint_a); + listener (std::shared_ptr const & tls_config_a, nano::logger &, nano::wallets & wallets_a, boost::asio::io_context & io_ctx_a, boost::asio::ip::tcp::endpoint endpoint_a); /** Start accepting connections */ void run (); @@ -348,7 +348,7 @@ namespace websocket void decrease_subscriber_count (nano::websocket::topic const & topic_a); std::shared_ptr tls_config; - nano::nlogger & nlogger; + nano::logger & logger; nano::wallets & wallets; boost::asio::ip::tcp::acceptor acceptor; socket_type socket; @@ -365,7 +365,7 @@ namespace websocket class websocket_server { public: - websocket_server (nano::websocket::config &, nano::node_observers &, nano::wallets &, nano::ledger &, boost::asio::io_context &, nano::nlogger &); + websocket_server (nano::websocket::config &, nano::node_observers &, nano::wallets &, nano::ledger &, boost::asio::io_context &, nano::logger &); void start (); void stop (); @@ -376,7 +376,7 @@ class websocket_server nano::wallets & wallets; nano::ledger & ledger; boost::asio::io_context & io_ctx; - nano::nlogger & nlogger; + nano::logger & logger; public: // TODO: Encapsulate, this is public just because existing code needs it diff --git a/nano/qt/qt.cpp b/nano/qt/qt.cpp index 7daf3a36fe..2b83d7d61a 100644 --- a/nano/qt/qt.cpp +++ b/nano/qt/qt.cpp @@ -1546,7 +1546,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) : retype_password->setPlaceholderText ("Retype password"); show_button_success (*change); change->setText ("Password was changed"); - this->wallet.node.nlogger.warn (nano::log::type::qt, "Wallet password changed"); + this->wallet.node.logger.warn (nano::log::type::qt, "Wallet password changed"); update_locked (false, false); this->wallet.node.workers.add_timed_task (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () { this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () { @@ -1639,7 +1639,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) : this->wallet.wallet_m->store.password.value_set (empty); update_locked (true, true); lock_toggle->setText ("Unlock"); - this->wallet.node.nlogger.warn (nano::log::type::qt, "Wallet locked"); + this->wallet.node.logger.warn (nano::log::type::qt, "Wallet locked"); password->setEnabled (1); } else diff --git a/nano/qt_test/entry.cpp b/nano/qt_test/entry.cpp index a34cb347dd..e8976178c4 100644 --- a/nano/qt_test/entry.cpp +++ b/nano/qt_test/entry.cpp @@ -17,7 +17,7 @@ void force_nano_dev_network (); int main (int argc, char ** argv) { - nano::nlogger::initialize_for_tests (nano::log_config::tests_default ()); + nano::logger::initialize_for_tests (nano::log_config::tests_default ()); nano::force_nano_dev_network (); nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard; QApplication application (argc, argv); diff --git a/nano/qt_test/qt.cpp b/nano/qt_test/qt.cpp index 8735ef9a06..b7b6621ae3 100644 --- a/nano/qt_test/qt.cpp +++ b/nano/qt_test/qt.cpp @@ -522,8 +522,8 @@ TEST (history, short_text) account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); - nano::nlogger nlogger; - auto store = nano::make_store (nlogger, nano::unique_path (), nano::dev::constants); + nano::logger logger; + auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::ledger ledger (*store, system.nodes[0]->stats, nano::dev::constants); { @@ -560,8 +560,8 @@ TEST (history, pruned_source) account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); - nano::nlogger nlogger; - auto store = nano::make_store (nlogger, nano::unique_path (), nano::dev::constants); + nano::logger logger; + auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_TRUE (!store->init_error ()); nano::ledger ledger (*store, system.nodes[0]->stats, nano::dev::constants); ledger.pruning = true; diff --git a/nano/rpc/rpc.cpp b/nano/rpc/rpc.cpp index 6209810352..687c9b316e 100644 --- a/nano/rpc/rpc.cpp +++ b/nano/rpc/rpc.cpp @@ -36,7 +36,7 @@ void nano::rpc::start () bool const is_loopback = (endpoint.address ().is_loopback () || (endpoint.address ().to_v6 ().is_v4_mapped () && boost::asio::ip::make_address_v4 (boost::asio::ip::v4_mapped, endpoint.address ().to_v6 ()).is_loopback ())); if (!is_loopback && config.enable_control) { - nlogger.warn (nano::log::type::rpc, "WARNING: Control-level RPCs are enabled on non-local address {}, potentially allowing wallet access outside local computer", endpoint.address ().to_string ()); + logger.warn (nano::log::type::rpc, "WARNING: Control-level RPCs are enabled on non-local address {}, potentially allowing wallet access outside local computer", endpoint.address ().to_string ()); } acceptor.open (endpoint.protocol ()); @@ -46,7 +46,7 @@ void nano::rpc::start () acceptor.bind (endpoint, ec); if (ec) { - nlogger.critical (nano::log::type::rpc, "Error while binding for RPC on port: {} ({})", endpoint.port (), ec.message ()); + logger.critical (nano::log::type::rpc, "Error while binding for RPC on port: {} ({})", endpoint.port (), ec.message ()); throw std::runtime_error (ec.message ()); } acceptor.listen (); @@ -55,7 +55,7 @@ void nano::rpc::start () void nano::rpc::accept () { - auto connection (std::make_shared (config, io_ctx, nlogger, rpc_handler_interface)); + auto connection (std::make_shared (config, io_ctx, logger, rpc_handler_interface)); acceptor.async_accept (connection->socket, boost::asio::bind_executor (connection->strand, [this, connection] (boost::system::error_code const & ec) { if (ec != boost::asio::error::operation_aborted && acceptor.is_open ()) { @@ -67,7 +67,7 @@ void nano::rpc::accept () } else { - nlogger.error (nano::log::type::rpc, "Error accepting RPC connection: {}", ec.message ()); + logger.error (nano::log::type::rpc, "Error accepting RPC connection: {}", ec.message ()); } })); } diff --git a/nano/rpc/rpc.hpp b/nano/rpc/rpc.hpp index 695de1467a..99f66b260a 100644 --- a/nano/rpc/rpc.hpp +++ b/nano/rpc/rpc.hpp @@ -31,7 +31,7 @@ class rpc return acceptor.local_endpoint ().port (); } - nano::nlogger nlogger{ "rpc" }; + nano::logger logger{ "rpc" }; nano::rpc_config config; boost::asio::ip::tcp::acceptor acceptor; boost::asio::io_context & io_ctx; diff --git a/nano/rpc/rpc_connection.cpp b/nano/rpc/rpc_connection.cpp index f8c4b34b59..d7c71562c1 100644 --- a/nano/rpc/rpc_connection.cpp +++ b/nano/rpc/rpc_connection.cpp @@ -13,11 +13,11 @@ #endif #include -nano::rpc_connection::rpc_connection (nano::rpc_config const & rpc_config, boost::asio::io_context & io_ctx, nano::nlogger & nlogger, nano::rpc_handler_interface & rpc_handler_interface) : +nano::rpc_connection::rpc_connection (nano::rpc_config const & rpc_config, boost::asio::io_context & io_ctx, nano::logger & logger, nano::rpc_handler_interface & rpc_handler_interface) : socket (io_ctx), strand (io_ctx.get_executor ()), io_ctx (io_ctx), - nlogger (nlogger), + logger (logger), rpc_config (rpc_config), rpc_handler_interface (rpc_handler_interface) { @@ -83,7 +83,7 @@ void nano::rpc_connection::read (STREAM_TYPE & stream) } else { - this_l->nlogger.error (nano::log::type::rpc_connection, "RPC header error: ", ec.message ()); + this_l->logger.error (nano::log::type::rpc_connection, "RPC header error: ", ec.message ()); // Respond with the reason for the invalid header auto response_handler ([this_l, &stream] (std::string const & tree_a) { @@ -123,7 +123,7 @@ void nano::rpc_connection::parse_request (STREAM_TYPE & stream, std::shared_ptr< })); // Bump logging level if RPC request logging is enabled - this_l->nlogger.log (this_l->rpc_config.rpc_logging.log_rpc ? nano::log::level::info : nano::log::level::debug, + this_l->logger.log (this_l->rpc_config.rpc_logging.log_rpc ? nano::log::level::info : nano::log::level::debug, nano::log::type::rpc_request, "RPC request {} completed in {} microseconds", request_id, std::chrono::duration_cast (std::chrono::steady_clock::now () - start).count ()); }); @@ -135,7 +135,7 @@ void nano::rpc_connection::parse_request (STREAM_TYPE & stream, std::shared_ptr< { case boost::beast::http::verb::post: { - auto handler (std::make_shared (this_l->rpc_config, req.body (), request_id, response_handler, this_l->rpc_handler_interface, this_l->nlogger)); + auto handler (std::make_shared (this_l->rpc_config, req.body (), request_id, response_handler, this_l->rpc_handler_interface, this_l->logger)); nano::rpc_handler_request_params request_params; request_params.rpc_version = rpc_version_l; request_params.credentials = header_field_credentials_l; @@ -164,7 +164,7 @@ void nano::rpc_connection::parse_request (STREAM_TYPE & stream, std::shared_ptr< } else { - this_l->nlogger.error (nano::log::type::rpc_connection, "RPC read error: ", ec.message ()); + this_l->logger.error (nano::log::type::rpc_connection, "RPC read error: ", ec.message ()); } })); } diff --git a/nano/rpc/rpc_connection.hpp b/nano/rpc/rpc_connection.hpp index da37b47e6d..960e0b31fa 100644 --- a/nano/rpc/rpc_connection.hpp +++ b/nano/rpc/rpc_connection.hpp @@ -25,7 +25,7 @@ class rpc_handler_interface; class rpc_connection : public std::enable_shared_from_this { public: - rpc_connection (nano::rpc_config const & rpc_config, boost::asio::io_context & io_ctx, nano::nlogger &, nano::rpc_handler_interface & rpc_handler_interface_a); + rpc_connection (nano::rpc_config const & rpc_config, boost::asio::io_context & io_ctx, nano::logger &, nano::rpc_handler_interface & rpc_handler_interface_a); virtual ~rpc_connection () = default; virtual void parse_connection (); virtual void write_completion_handler (std::shared_ptr const & rpc_connection); @@ -38,7 +38,7 @@ class rpc_connection : public std::enable_shared_from_this boost::asio::strand strand; std::atomic_flag responded; boost::asio::io_context & io_ctx; - nano::nlogger & nlogger; + nano::logger & logger; nano::rpc_config const & rpc_config; nano::rpc_handler_interface & rpc_handler_interface; diff --git a/nano/rpc/rpc_handler.cpp b/nano/rpc/rpc_handler.cpp index a4e5f05dac..241c46c47c 100644 --- a/nano/rpc/rpc_handler.cpp +++ b/nano/rpc/rpc_handler.cpp @@ -17,13 +17,13 @@ std::unordered_set rpc_control_impl_set = create_rpc_control_impls std::string filter_request (boost::property_tree::ptree tree_a); } -nano::rpc_handler::rpc_handler (nano::rpc_config const & rpc_config, std::string const & body_a, std::string const & request_id_a, std::function const & response_a, nano::rpc_handler_interface & rpc_handler_interface_a, nano::nlogger & nlogger) : +nano::rpc_handler::rpc_handler (nano::rpc_config const & rpc_config, std::string const & body_a, std::string const & request_id_a, std::function const & response_a, nano::rpc_handler_interface & rpc_handler_interface_a, nano::logger & logger) : body (body_a), request_id (request_id_a), response (response_a), rpc_config (rpc_config), rpc_handler_interface (rpc_handler_interface_a), - nlogger (nlogger) + logger (logger) { } @@ -63,7 +63,7 @@ void nano::rpc_handler::process_request (nano::rpc_handler_request_params const auto action = request.get ("action"); // Bump logging level if RPC request logging is enabled - nlogger.log (rpc_config.rpc_logging.log_rpc ? nano::log::level::info : nano::log::level::debug, + logger.log (rpc_config.rpc_logging.log_rpc ? nano::log::level::info : nano::log::level::debug, nano::log::type::rpc_request, "Request {} : {}", request_id, filter_request (request)); // Check if this is a RPC command which requires RPC enabled control diff --git a/nano/rpc/rpc_handler.hpp b/nano/rpc/rpc_handler.hpp index b8fd6093ce..55a979fa07 100644 --- a/nano/rpc/rpc_handler.hpp +++ b/nano/rpc/rpc_handler.hpp @@ -16,7 +16,7 @@ class rpc_handler_request_params; class rpc_handler : public std::enable_shared_from_this { public: - rpc_handler (nano::rpc_config const & rpc_config, std::string const & body_a, std::string const & request_id_a, std::function const & response_a, nano::rpc_handler_interface & rpc_handler_interface_a, nano::nlogger &); + rpc_handler (nano::rpc_config const & rpc_config, std::string const & body_a, std::string const & request_id_a, std::function const & response_a, nano::rpc_handler_interface & rpc_handler_interface_a, nano::logger &); void process_request (nano::rpc_handler_request_params const & request_params); private: @@ -26,6 +26,6 @@ class rpc_handler : public std::enable_shared_from_this std::function response; nano::rpc_config const & rpc_config; nano::rpc_handler_interface & rpc_handler_interface; - nano::nlogger & nlogger; + nano::logger & logger; }; } diff --git a/nano/rpc/rpc_secure.cpp b/nano/rpc/rpc_secure.cpp index 8548a8f843..9640e28c2f 100644 --- a/nano/rpc/rpc_secure.cpp +++ b/nano/rpc/rpc_secure.cpp @@ -15,7 +15,7 @@ nano::rpc_secure::rpc_secure (boost::asio::io_context & context_a, nano::rpc_con void nano::rpc_secure::accept () { - auto connection (std::make_shared (config, io_ctx, nlogger, rpc_handler_interface, config.tls_config->ssl_context)); + auto connection (std::make_shared (config, io_ctx, logger, rpc_handler_interface, config.tls_config->ssl_context)); acceptor.async_accept (connection->socket, boost::asio::bind_executor (connection->strand, [this, connection] (boost::system::error_code const & ec) { if (ec != boost::asio::error::operation_aborted && acceptor.is_open ()) { @@ -27,7 +27,7 @@ void nano::rpc_secure::accept () } else { - nlogger.error (nano::log::type::rpc, "Error accepting RPC connection: {}", ec.message ()); + logger.error (nano::log::type::rpc, "Error accepting RPC connection: {}", ec.message ()); } })); } diff --git a/nano/rpc_test/entry.cpp b/nano/rpc_test/entry.cpp index be70e1183e..2a94b7d9e7 100644 --- a/nano/rpc_test/entry.cpp +++ b/nano/rpc_test/entry.cpp @@ -15,7 +15,7 @@ void force_nano_dev_network (); int main (int argc, char ** argv) { - nano::nlogger::initialize_for_tests (nano::log_config::tests_default ()); + nano::logger::initialize_for_tests (nano::log_config::tests_default ()); nano::force_nano_dev_network (); nano::set_use_memory_pools (false); nano::node_singleton_memory_pool_purge_guard cleanup_guard; diff --git a/nano/secure/ledger.cpp b/nano/secure/ledger.cpp index e7c511b8bd..0fc1ecd604 100644 --- a/nano/secure/ledger.cpp +++ b/nano/secure/ledger.cpp @@ -1559,13 +1559,13 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p auto rockdb_data_path = data_path_a / "rocksdb"; std::filesystem::remove_all (rockdb_data_path); - nano::nlogger nlogger; + nano::logger logger; auto error (false); // Open rocksdb database nano::rocksdb_config rocksdb_config; rocksdb_config.enable = true; - auto rocksdb_store = nano::make_store (nlogger, data_path_a, nano::dev::constants, false, true, rocksdb_config); + auto rocksdb_store = nano::make_store (logger, data_path_a, nano::dev::constants, false, true, rocksdb_config); if (!rocksdb_store->init_error ()) { diff --git a/nano/slow_test/entry.cpp b/nano/slow_test/entry.cpp index 5e3ff3ea5a..0b9a0ca758 100644 --- a/nano/slow_test/entry.cpp +++ b/nano/slow_test/entry.cpp @@ -14,7 +14,7 @@ void force_nano_dev_network (); int main (int argc, char ** argv) { - nano::nlogger::initialize_for_tests (nano::log_config::tests_default ()); + nano::logger::initialize_for_tests (nano::log_config::tests_default ()); nano::force_nano_dev_network (); nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard; testing::InitGoogleTest (&argc, argv); diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index 141ae86cc7..4310968dae 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -117,7 +117,7 @@ TEST (system, receive_while_synchronizing) TEST (ledger, deep_account_compute) { - nano::nlogger logger; + nano::logger logger; auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants); ASSERT_FALSE (store->init_error ()); nano::stats stats; @@ -537,7 +537,7 @@ TEST (store, vote_load) */ TEST (store, pruned_load) { - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); constexpr auto num_pruned = 2000000; auto const expected_result = num_pruned / 2; @@ -1223,7 +1223,7 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) // Don't test this in rocksdb mode return; } - nano::nlogger logger; + nano::logger logger; auto path (nano::unique_path ()); auto store = nano::make_store (logger, path, nano::dev::constants); ASSERT_TRUE (!store->init_error ()); diff --git a/nano/store/lmdb/lmdb.cpp b/nano/store/lmdb/lmdb.cpp index ccc5a4934c..4dd9e64407 100644 --- a/nano/store/lmdb/lmdb.cpp +++ b/nano/store/lmdb/lmdb.cpp @@ -12,7 +12,7 @@ #include -nano::store::lmdb::component::component (nano::nlogger & nlogger_a, std::filesystem::path const & path_a, nano::ledger_constants & constants, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade_a) : +nano::store::lmdb::component::component (nano::logger & logger_a, std::filesystem::path const & path_a, nano::ledger_constants & constants, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade_a) : // clang-format off nano::store::component{ block_store, @@ -37,9 +37,9 @@ nano::store::lmdb::component::component (nano::nlogger & nlogger_a, std::filesys confirmation_height_store{ *this }, final_vote_store{ *this }, version_store{ *this }, - nlogger{ nlogger_a }, + logger{ logger_a }, env (error, path_a, nano::store::lmdb::env::options::make ().set_config (lmdb_config_a).set_use_no_mem_init (true)), - mdb_txn_tracker (nlogger_a, txn_tracking_config_a, block_processor_batch_max_time_a), + mdb_txn_tracker (logger_a, txn_tracking_config_a, block_processor_batch_max_time_a), txn_tracking_enabled (txn_tracking_config_a.enable) { if (!error) @@ -66,11 +66,11 @@ nano::store::lmdb::component::component (nano::nlogger & nlogger_a, std::filesys { if (!is_fresh_db) { - nlogger.info (nano::log::type::lmdb, "Upgrade in progress..."); + logger.info (nano::log::type::lmdb, "Upgrade in progress..."); if (backup_before_upgrade_a) { - create_backup_file (env, path_a, nlogger); + create_backup_file (env, path_a, logger); } } auto needs_vacuuming = false; @@ -85,17 +85,17 @@ nano::store::lmdb::component::component (nano::nlogger & nlogger_a, std::filesys if (needs_vacuuming) { - nlogger.info (nano::log::type::lmdb, "Ledger vaccum in progress..."); + logger.info (nano::log::type::lmdb, "Ledger vaccum in progress..."); auto vacuum_success = vacuum_after_upgrade (path_a, lmdb_config_a); if (vacuum_success) { - nlogger.info (nano::log::type::lmdb, "Ledger vacuum completed"); + logger.info (nano::log::type::lmdb, "Ledger vacuum completed"); } else { - nlogger.error (nano::log::type::lmdb, "Ledger vaccum failed"); - nlogger.error (nano::log::type::lmdb, "(Optional) Please ensure enough disk space is available for a copy of the database and try to vacuum after shutting down the node"); + logger.error (nano::log::type::lmdb, "Ledger vaccum failed"); + logger.error (nano::log::type::lmdb, "(Optional) Please ensure enough disk space is available for a copy of the database and try to vacuum after shutting down the node"); } } } @@ -212,7 +212,7 @@ bool nano::store::lmdb::component::do_upgrades (store::write_transaction & trans auto version_l = version.get (transaction_a); if (version_l < version_minimum) { - nlogger.critical (nano::log::type::lmdb, "The version of the ledger ({}) is lower than the minimum ({}) which is supported for upgrades. Either upgrade a node first or delete the ledger.", version_l, version_minimum); + logger.critical (nano::log::type::lmdb, "The version of the ledger ({}) is lower than the minimum ({}) which is supported for upgrades. Either upgrade a node first or delete the ledger.", version_l, version_minimum); return true; } switch (version_l) @@ -223,7 +223,7 @@ bool nano::store::lmdb::component::do_upgrades (store::write_transaction & trans case 22: break; default: - nlogger.critical (nano::log::type::lmdb, "The version of the ledger ({}) is too high for this node", version_l); + logger.critical (nano::log::type::lmdb, "The version of the ledger ({}) is too high for this node", version_l); error = true; break; } @@ -232,18 +232,18 @@ bool nano::store::lmdb::component::do_upgrades (store::write_transaction & trans void nano::store::lmdb::component::upgrade_v21_to_v22 (store::write_transaction const & transaction_a) { - nlogger.info (nano::log::type::lmdb, "Upgrading database from v21 to v22..."); + logger.info (nano::log::type::lmdb, "Upgrading database from v21 to v22..."); MDB_dbi unchecked_handle{ 0 }; release_assert (!mdb_dbi_open (env.tx (transaction_a), "unchecked", MDB_CREATE, &unchecked_handle)); release_assert (!mdb_drop (env.tx (transaction_a), unchecked_handle, 1)); // del = 1, to delete it from the environment and close the DB handle. version.put (transaction_a, 22); - nlogger.info (nano::log::type::lmdb, "Upgrading database from v21 to v22 completed"); + logger.info (nano::log::type::lmdb, "Upgrading database from v21 to v22 completed"); } /** Takes a filepath, appends '_backup_' to the end (but before any extension) and saves that file in the same directory */ -void nano::store::lmdb::component::create_backup_file (nano::store::lmdb::env & env_a, std::filesystem::path const & filepath_a, nano::nlogger & nlogger) +void nano::store::lmdb::component::create_backup_file (nano::store::lmdb::env & env_a, std::filesystem::path const & filepath_a, nano::logger & logger) { auto extension = filepath_a.extension (); auto filename_without_extension = filepath_a.filename ().replace_extension (""); @@ -255,17 +255,17 @@ void nano::store::lmdb::component::create_backup_file (nano::store::lmdb::env & backup_filename += extension; auto backup_filepath = backup_path / backup_filename; - nlogger.info (nano::log::type::lmdb, "Performing {} backup before database upgrade...", filepath_a.filename ().string ()); + logger.info (nano::log::type::lmdb, "Performing {} backup before database upgrade...", filepath_a.filename ().string ()); auto error (mdb_env_copy (env_a, backup_filepath.string ().c_str ())); if (error) { - nlogger.critical (nano::log::type::lmdb, "Database backup failed"); + logger.critical (nano::log::type::lmdb, "Database backup failed"); std::exit (1); } else { - nlogger.info (nano::log::type::lmdb, "Database backup completed. Backup can be found at: {}", backup_filepath.string ()); + logger.info (nano::log::type::lmdb, "Database backup completed. Backup can be found at: {}", backup_filepath.string ()); } } diff --git a/nano/store/lmdb/lmdb.hpp b/nano/store/lmdb/lmdb.hpp index 5b28dbdf11..a1f5dda6cf 100644 --- a/nano/store/lmdb/lmdb.hpp +++ b/nano/store/lmdb/lmdb.hpp @@ -63,7 +63,7 @@ class component : public nano::store::component friend class nano::store::lmdb::version; public: - component (nano::nlogger &, std::filesystem::path const &, nano::ledger_constants & constants, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false); + component (nano::logger &, std::filesystem::path const &, nano::ledger_constants & constants, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false); store::write_transaction tx_begin_write (std::vector const & tables_requiring_lock = {}, std::vector const & tables_no_lock = {}) override; store::read_transaction tx_begin_read () const override; @@ -71,14 +71,14 @@ class component : public nano::store::component void serialize_mdb_tracker (boost::property_tree::ptree &, std::chrono::milliseconds, std::chrono::milliseconds) override; - static void create_backup_file (nano::store::lmdb::env &, std::filesystem::path const &, nano::nlogger &); + static void create_backup_file (nano::store::lmdb::env &, std::filesystem::path const &, nano::logger &); void serialize_memory_stats (boost::property_tree::ptree &) override; unsigned max_block_write_batch_num () const override; private: - nano::nlogger & nlogger; + nano::logger & logger; bool error{ false }; public: diff --git a/nano/store/lmdb/transaction.cpp b/nano/store/lmdb/transaction.cpp index c75fdc736c..2460539cfb 100644 --- a/nano/store/lmdb/transaction.cpp +++ b/nano/store/lmdb/transaction.cpp @@ -116,8 +116,8 @@ bool nano::store::lmdb::write_transaction_impl::contains (nano::tables table_a) return true; } -nano::mdb_txn_tracker::mdb_txn_tracker (nano::nlogger & nlogger_a, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a) : - nlogger (nlogger_a), +nano::mdb_txn_tracker::mdb_txn_tracker (nano::logger & logger_a, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a) : + logger (logger_a), txn_tracking_config (txn_tracking_config_a), block_processor_batch_max_time (block_processor_batch_max_time_a) { @@ -195,7 +195,7 @@ void nano::mdb_txn_tracker::log_if_held_long_enough (nano::mdb_txn_stats const & { debug_assert (mdb_txn_stats.stacktrace); - nlogger.warn (nano::log::type::txn_tracker, "{}ms {} held on thread {}\n{}", + logger.warn (nano::log::type::txn_tracker, "{}ms {} held on thread {}\n{}", time_open.count (), is_write ? "write lock" : "read", mdb_txn_stats.thread_name, diff --git a/nano/store/lmdb/transaction_impl.hpp b/nano/store/lmdb/transaction_impl.hpp index 971908b5da..06a4e1d414 100644 --- a/nano/store/lmdb/transaction_impl.hpp +++ b/nano/store/lmdb/transaction_impl.hpp @@ -72,7 +72,7 @@ class mdb_txn_stats class mdb_txn_tracker { public: - mdb_txn_tracker (nano::nlogger &, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a); + mdb_txn_tracker (nano::logger &, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a); void serialize_json (boost::property_tree::ptree & json, std::chrono::milliseconds min_read_time, std::chrono::milliseconds min_write_time); void add (store::transaction_impl const * transaction_impl); void erase (store::transaction_impl const * transaction_impl); @@ -80,7 +80,7 @@ class mdb_txn_tracker private: nano::mutex mutex; std::vector stats; - nano::nlogger & nlogger; + nano::logger & logger; nano::txn_tracking_config txn_tracking_config; std::chrono::milliseconds block_processor_batch_max_time; diff --git a/nano/store/rocksdb/rocksdb.cpp b/nano/store/rocksdb/rocksdb.cpp index a29e301311..099972583c 100644 --- a/nano/store/rocksdb/rocksdb.cpp +++ b/nano/store/rocksdb/rocksdb.cpp @@ -34,7 +34,7 @@ class event_listener : public rocksdb::EventListener }; } -nano::store::rocksdb::component::component (nano::nlogger & nlogger_a, std::filesystem::path const & path_a, nano::ledger_constants & constants, nano::rocksdb_config const & rocksdb_config_a, bool open_read_only_a) : +nano::store::rocksdb::component::component (nano::logger & logger_a, std::filesystem::path const & path_a, nano::ledger_constants & constants, nano::rocksdb_config const & rocksdb_config_a, bool open_read_only_a) : // clang-format off nano::store::component{ block_store, @@ -59,7 +59,7 @@ nano::store::rocksdb::component::component (nano::nlogger & nlogger_a, std::file confirmation_height_store{ *this }, final_vote_store{ *this }, version_store{ *this }, - nlogger{ nlogger_a }, + logger{ logger_a }, constants{ constants }, rocksdb_config{ rocksdb_config_a }, max_block_write_batch_num_m{ nano::narrow_cast (blocks_memtable_size_bytes () / (2 * (sizeof (nano::block_type) + nano::state_block::size + nano::block_sideband::size (nano::block_type::state)))) }, @@ -95,14 +95,14 @@ nano::store::rocksdb::component::component (nano::nlogger & nlogger_a, std::file auto version_l = version.get (transaction); if (version_l > version_current) { - nlogger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is too high for this node", version_l); + logger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is too high for this node", version_l); error = true; return; } else if (version_l < version_minimum) { - nlogger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is lower than the minimum ({}) which is supported for upgrades. Either upgrade a node first or delete the ledger.", version_l, version_minimum); + logger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is lower than the minimum ({}) which is supported for upgrades. Either upgrade a node first or delete the ledger.", version_l, version_minimum); error = true; return; @@ -151,7 +151,7 @@ nano::store::rocksdb::component::component (nano::nlogger & nlogger_a, std::file open (error, path_a, open_read_only_a, options, get_current_column_families (path_a.string (), options)); if (!error) { - nlogger.info (nano::log::type::rocksdb, "Upgrade in progress..."); + logger.info (nano::log::type::rocksdb, "Upgrade in progress..."); auto transaction = tx_begin_write (); error |= do_upgrades (transaction); @@ -243,7 +243,7 @@ bool nano::store::rocksdb::component::do_upgrades (store::write_transaction cons case 22: break; default: - nlogger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is too high for this node", version_l); + logger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is too high for this node", version_l); error_l = true; break; } @@ -252,7 +252,7 @@ bool nano::store::rocksdb::component::do_upgrades (store::write_transaction cons void nano::store::rocksdb::component::upgrade_v21_to_v22 (store::write_transaction const & transaction_a) { - nlogger.info (nano::log::type::rocksdb, "Upgrading database from v21 to v22..."); + logger.info (nano::log::type::rocksdb, "Upgrading database from v21 to v22..."); if (column_family_exists ("unchecked")) { @@ -268,12 +268,12 @@ void nano::store::rocksdb::component::upgrade_v21_to_v22 (store::write_transacti } return false; }); - nlogger.debug (nano::log::type::rocksdb, "Finished removing unchecked table"); + logger.debug (nano::log::type::rocksdb, "Finished removing unchecked table"); } version.put (transaction_a, 22); - nlogger.info (nano::log::type::rocksdb, "Upgrading database from v21 to v22 completed"); + logger.info (nano::log::type::rocksdb, "Upgrading database from v21 to v22 completed"); } void nano::store::rocksdb::component::generate_tombstone_map () @@ -916,7 +916,7 @@ bool nano::store::rocksdb::component::copy_db (std::filesystem::path const & des // Open it so that it flushes all WAL files if (status.ok ()) { - nano::store::rocksdb::component rocksdb_store{ nlogger, destination_path.string (), constants, rocksdb_config, false }; + nano::store::rocksdb::component rocksdb_store{ logger, destination_path.string (), constants, rocksdb_config, false }; return !rocksdb_store.init_error (); } return false; diff --git a/nano/store/rocksdb/rocksdb.hpp b/nano/store/rocksdb/rocksdb.hpp index 92a093504f..1c51bbbb05 100644 --- a/nano/store/rocksdb/rocksdb.hpp +++ b/nano/store/rocksdb/rocksdb.hpp @@ -64,7 +64,7 @@ class component : public nano::store::component friend class nano::store::rocksdb::pruned; friend class nano::store::rocksdb::version; - explicit component (nano::nlogger &, std::filesystem::path const &, nano::ledger_constants & constants, nano::rocksdb_config const & = nano::rocksdb_config{}, bool open_read_only = false); + explicit component (nano::logger &, std::filesystem::path const &, nano::ledger_constants & constants, nano::rocksdb_config const & = nano::rocksdb_config{}, bool open_read_only = false); store::write_transaction tx_begin_write (std::vector const & tables_requiring_lock = {}, std::vector const & tables_no_lock = {}) override; store::read_transaction tx_begin_read () const override; @@ -103,7 +103,7 @@ class component : public nano::store::component private: bool error{ false }; - nano::nlogger & nlogger; + nano::logger & logger; nano::ledger_constants & constants; // Optimistic transactions are used in write mode ::rocksdb::OptimisticTransactionDB * optimistic_db = nullptr; diff --git a/nano/test_common/ledger.cpp b/nano/test_common/ledger.cpp index 7755ebaa7a..a3337bc925 100644 --- a/nano/test_common/ledger.cpp +++ b/nano/test_common/ledger.cpp @@ -3,7 +3,7 @@ #include nano::test::context::ledger_context::ledger_context (std::deque> && blocks) : - store_m{ nano::make_store (nlogger, nano::unique_path (), nano::dev::constants) }, + store_m{ nano::make_store (logger, nano::unique_path (), nano::dev::constants) }, ledger_m{ *store_m, stats_m, nano::dev::constants }, blocks_m{ blocks } { diff --git a/nano/test_common/ledger.hpp b/nano/test_common/ledger.hpp index 09c5d1bfa4..6b12c258a2 100644 --- a/nano/test_common/ledger.hpp +++ b/nano/test_common/ledger.hpp @@ -25,7 +25,7 @@ namespace test std::deque> const & blocks () const; private: - nano::nlogger nlogger; + nano::logger logger; std::unique_ptr store_m; nano::stats stats_m; nano::ledger ledger_m; diff --git a/nano/test_common/system.hpp b/nano/test_common/system.hpp index 278492edf4..8bff408828 100644 --- a/nano/test_common/system.hpp +++ b/nano/test_common/system.hpp @@ -67,7 +67,7 @@ namespace test boost::asio::io_context io_ctx; std::vector> nodes; nano::stats stats; - nano::nlogger nlogger; + nano::logger logger; nano::work_pool work{ nano::dev::network_params.network, std::max (nano::hardware_concurrency (), 1u) }; std::chrono::time_point> deadline{ std::chrono::steady_clock::time_point::max () }; double deadline_scaling_factor{ 1.0 };