Skip to content

Commit

Permalink
Rename back to nano::logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 19, 2024
1 parent f42beb8 commit f4fee1d
Show file tree
Hide file tree
Showing 80 changed files with 544 additions and 544 deletions.
96 changes: 48 additions & 48 deletions nano/core_test/block_store.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions nano/core_test/bootstrap_ascending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand Down
10 changes: 5 additions & 5 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
Expand Down Expand Up @@ -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 ());
Expand Down Expand Up @@ -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 ());
Expand Down Expand Up @@ -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 ());
Expand Down Expand Up @@ -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 ());
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/core_test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3296,7 +3296,7 @@ TEST (node, dont_write_lock_node)
std::promise<void> write_lock_held_promise;
std::promise<void> 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;
Expand Down
4 changes: 2 additions & 2 deletions nano/core_test/processor_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/work_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 15 additions & 15 deletions nano/lib/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ namespace
std::atomic<bool> 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<spdlog::sink_ptr> nano::nlogger::global_sinks{};
bool nano::logger::global_initialized{ false };
nano::log_config nano::logger::global_config{};
std::vector<spdlog::sink_ptr> 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<std::string (nano::log::type tag, std::string identifier)> nano::nlogger::global_name_formatter{ [] (auto tag, auto identifier) {
std::function<std::string (nano::log::type tag, std::string identifier)> 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<std::string> const & config_overrides)
void nano::logger::initialize (nano::log_config fallback, std::filesystem::path data_path, std::vector<std::string> const & config_overrides)
{
auto config = nano::load_log_config (std::move (fallback), data_path, config_overrides);
initialize_common (config, data_path);
Expand Down Expand Up @@ -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 */ {});
Expand All @@ -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;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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
{
Expand All @@ -220,7 +220,7 @@ spdlog::logger & nano::nlogger::get_logger (nano::log::type tag)
}
}

std::shared_ptr<spdlog::logger> nano::nlogger::make_logger (nano::log::type tag)
std::shared_ptr<spdlog::logger> nano::logger::make_logger (nano::log::type tag)
{
auto const & config = global_config;
auto const & sinks = global_sinks;
Expand Down
Loading

0 comments on commit f4fee1d

Please sign in to comment.