From 75d4ce26045c3af77e097775307af95283a8865a Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Sun, 5 May 2024 12:23:10 +0300 Subject: [PATCH 1/7] BEAM_LOG_WARNING BEAM_LOG_UNHANDLED_EXCEPTION BEAM_LOG_CRITICAL BEAM_LOG_ERROR BEAM_LOG_INFO BEAM_LOG_MESSAGE --- 3rdparty/libbitcoin/examples/atomic_swap.cpp | 38 ++--- .../examples/electrum_get_balance.cpp | 16 +-- 3rdparty/libbitcoin/examples/get_info.cpp | 12 +- android/dao/apps_api_ui.cpp | 12 +- android/dao/web_api_creator.cpp | 2 +- android/jni.cpp | 26 ++-- beam/cli.cpp | 36 ++--- bvm/ethash_service/ethash_service.cpp | 4 +- core/block_crypt.cpp | 4 +- core/peer_manager.cpp | 6 +- core/proto.cpp | 6 +- explorer/adapter.cpp | 4 +- explorer/explorer_node.cpp | 20 +-- explorer/server.cpp | 12 +- explorer/unittest/adapter_test.cpp | 8 +- http/unittests/http_client_test.cpp | 6 +- http/unittests/http_parser_test.cpp | 14 +- http/unittests/http_test.cpp | 26 ++-- keykeeper/trezor_key_keeper.cpp | 6 +- node/db.cpp | 6 +- node/functionaltests/check_mined_test.cpp | 16 +-- .../double_spending_2_tx_test.cpp | 16 +-- node/functionaltests/double_spending_test.cpp | 12 +- .../experiment_with_sieze_tx_test.cpp | 4 +- node/functionaltests/fraction_coin_test.cpp | 14 +- node/functionaltests/send_big_tx_test.cpp | 8 +- .../send_broken_new_tx_test.cpp | 6 +- .../send_data_missing_test.cpp | 6 +- .../send_empty_kernels_test.cpp | 16 +-- node/functionaltests/send_gethdr_test.cpp | 18 +-- node/functionaltests/send_getmined_test.cpp | 18 +-- .../send_getproofutxo_test.cpp | 10 +- node/functionaltests/send_peer_info_test.cpp | 8 +- .../send_to_node_10tx_test.cpp | 4 +- .../send_tx_with_equal_commitment_test.cpp | 12 +- .../send_tx_with_unsorted_test.cpp | 10 +- .../send_tx_with_zero_output_test.cpp | 12 +- .../send_wrong_newtip_test.cpp | 12 +- node/functionaltests/send_wrong_tx_test.cpp | 78 +++++------ .../spam_havetransactions_test.cpp | 4 +- .../spam_transactions_test.cpp | 4 +- node/functionaltests/spam_valid_tx_test.cpp | 14 +- node/functionaltests/spend_fee_test.cpp | 18 +-- .../spend_mined_coins_test.cpp | 14 +- .../tools/base_node_connection.cpp | 8 +- node/functionaltests/tools/coins_checker.cpp | 4 +- node/functionaltests/tools/new_tx_tests.cpp | 4 +- ...try_spend_unknown_and_known_coins_test.cpp | 12 +- .../try_spend_unknown_coins_test.cpp | 12 +- node/node.cpp | 126 ++++++++--------- node/node_client.cpp | 20 +-- node/processor.cpp | 112 +++++++-------- node/unittests/node_1_test.cpp | 10 +- node/unittests/node_test.cpp | 6 +- node/utils/laser_beam_demo.cpp | 2 +- node/utils/node_net_sim.cpp | 2 +- node/utils/pipe_link.cpp | 2 +- p2p/protocol_base.cpp | 6 +- p2p/unittest/dialog_test.cpp | 30 ++-- p2p/unittest/filesend_test.cpp | 34 ++--- pow/external_pow_stub.cpp | 6 +- pow/miner_client.cpp | 46 +++---- pow/opencl_pow.cpp | 14 +- pow/stratum.cpp | 6 +- pow/stratum_server.cpp | 26 ++-- pow/unittests/server_stub.cpp | 12 +- pow/unittests/stratum_test.cpp | 10 +- utility/asynccontext.cpp | 4 +- utility/cli/options.cpp | 10 +- utility/cli/options.h | 2 +- utility/io/coarsetimer.cpp | 12 +- utility/io/json_serializer.cpp | 2 +- utility/io/proxy_connector.cpp | 2 +- utility/io/reactor.cpp | 16 +-- utility/io/sslio.cpp | 26 ++-- utility/log_rotation.cpp | 4 +- utility/logger.h | 50 +++---- utility/logger_checkpoints.cpp | 2 +- utility/unittest/logger_test.cpp | 18 +-- utility/unittest/proxy_test.cpp | 4 +- utility/unittest/reactor_test.cpp | 6 +- utility/unittest/ssl_test.cpp | 16 +-- utility/unittest/tcpclient_test.cpp | 18 +-- utility/unittest/tcpserver_test.cpp | 8 +- utility/unittest/timer_test.cpp | 4 +- wallet/api/base/api_base.cpp | 6 +- wallet/api/base/api_base.h | 4 +- wallet/api/cli/api_cli.cpp | 64 ++++----- wallet/api/cli/api_server.h | 18 +-- wallet/api/i_wallet_api.cpp | 2 +- wallet/api/v6_0/v6_api_handle.cpp | 10 +- wallet/api/v6_0/v6_api_parse.cpp | 12 +- wallet/api/v6_1/v6_1_api_handle.cpp | 6 +- wallet/api/v6_1/v6_1_api_notify.cpp | 18 +-- wallet/api/v7_0/v7_0_api_handle.cpp | 24 ++-- wallet/api/v7_3/v7_3_api_handle.cpp | 2 +- wallet/broadcaster/broadcaster.cpp | 44 +++--- wallet/cli/cli.cpp | 110 +++++++-------- wallet/cli/laser.cpp | 52 +++---- wallet/cli/swaps.cpp | 20 +-- wallet/cli/utils.cpp | 20 +-- wallet/client/apps_api/apps_api.cpp | 6 +- wallet/client/apps_api/apps_api.h | 20 +-- .../broadcast_msg_validator.cpp | 2 +- .../client/extensions/dex_board/dex_board.cpp | 6 +- .../news_channels/exchange_rate_provider.cpp | 6 +- .../news_channels/updates_provider.cpp | 2 +- .../news_channels/verification_provider.cpp | 2 +- .../news_channels/wallet_updates_provider.cpp | 2 +- .../notifications/notification_center.cpp | 4 +- .../offers_board/offers_protocol_handler.cpp | 4 +- .../offers_board/swap_offers_board.cpp | 8 +- wallet/client/wallet_client.cpp | 120 ++++++++-------- wallet/core/assets_utils.cpp | 18 +-- wallet/core/base_transaction.cpp | 18 +-- wallet/core/base_tx_builder.cpp | 10 +- wallet/core/common.cpp | 8 +- wallet/core/contract_transaction.cpp | 26 ++-- wallet/core/contracts/shaders_manager.cpp | 14 +- wallet/core/currency.cpp | 2 +- wallet/core/node_network.cpp | 8 +- wallet/core/simple_transaction.cpp | 6 +- wallet/core/wallet.cpp | 90 ++++++------ wallet/core/wallet_db.cpp | 130 +++++++++--------- wallet/core/wallet_network.cpp | 14 +- wallet/ipfs/ipfs_imp.cpp | 40 +++--- wallet/laser/channel.cpp | 10 +- wallet/laser/connection.cpp | 2 +- wallet/laser/mediator.cpp | 92 ++++++------- .../assets/aissue_transaction.cpp | 2 +- .../assets/aregister_transaction.cpp | 4 +- .../assets/aunregister_transaction.cpp | 4 +- wallet/transactions/dex/dex_tx.cpp | 4 +- wallet/transactions/dex/dex_tx_builder.cpp | 2 +- .../lelantus/pull_transaction.cpp | 4 +- .../lelantus/push_transaction.cpp | 4 +- .../lelantus/unlink_transaction.cpp | 6 +- .../bridges/bitcoin/bitcoin_core_016.cpp | 2 +- .../swaps/bridges/bitcoin/bitcoin_side.cpp | 38 ++--- .../swaps/bridges/bitcoin/electrum.cpp | 16 +-- .../bridges/ethereum/ethereum_bridge.cpp | 2 +- .../swaps/bridges/ethereum/ethereum_side.cpp | 12 +- .../transactions/swaps/swap_transaction.cpp | 62 ++++----- wallet/unittests/bitcoin_rpc_environment.cpp | 6 +- wallet/unittests/bitcoin_rpc_test.cpp | 4 +- wallet/unittests/electrum_test.cpp | 6 +- wallet/unittests/ethereum_test.cpp | 2 +- wallet/unittests/laser_test_auto_close.cpp | 20 +-- wallet/unittests/laser_test_close.cpp | 20 +-- wallet/unittests/laser_test_delete.cpp | 24 ++-- wallet/unittests/laser_test_drop.cpp | 20 +-- wallet/unittests/laser_test_listen_first.cpp | 30 ++-- wallet/unittests/laser_test_listen_second.cpp | 30 ++-- wallet/unittests/laser_test_open.cpp | 14 +- wallet/unittests/laser_test_open_fail.cpp | 8 +- wallet/unittests/laser_test_send.cpp | 32 ++--- wallet/unittests/laser_test_send_fail.cpp | 16 +-- wallet/unittests/lelantus_test.cpp | 2 +- wallet/unittests/offline.cpp | 22 +-- wallet/unittests/swap_test.cpp | 4 +- wallet/unittests/swap_test_environment.cpp | 10 +- wallet/unittests/wallet_assets_test.cpp | 30 ++-- wallet/unittests/wallet_contract_test.cpp | 2 +- wallet/unittests/wallet_db_test.cpp | 8 +- wallet/unittests/wallet_test.cpp | 10 +- wallet/unittests/wallet_test_environment.cpp | 2 +- wasmclient/wasmclient.cpp | 28 ++-- websocket/sessions.cpp | 2 +- websocket/unittests/websocket_test.cpp | 2 +- websocket/websocket_server.cpp | 6 +- 170 files changed, 1458 insertions(+), 1458 deletions(-) diff --git a/3rdparty/libbitcoin/examples/atomic_swap.cpp b/3rdparty/libbitcoin/examples/atomic_swap.cpp index 72b4f6883..a7f6fea3e 100644 --- a/3rdparty/libbitcoin/examples/atomic_swap.cpp +++ b/3rdparty/libbitcoin/examples/atomic_swap.cpp @@ -167,16 +167,16 @@ namespace request.body(requestData.data(), requestData.size()); //request.body(data, strlen(data)); - LOG_INFO() << requestData << "\n"; + BEAM_LOG_INFO() << requestData << "\n"; request.callback([callback](uint64_t id, const HttpMsgReader::Message& msg) -> bool { - LOG_INFO() << "response from " << id; + BEAM_LOG_INFO() << "response from " << id; size_t sz = 0; const void* body = msg.msg->get_body(sz); if (sz > 0 && body) { json j = json::parse(std::string(static_cast(body), sz)); - LOG_INFO() << j.dump(JSON_FORMAT_INDENT); + BEAM_LOG_INFO() << j.dump(JSON_FORMAT_INDENT); callback(j); } @@ -305,8 +305,8 @@ void AtomicSwapHelper::OnFundRawTransaction(const json& reply) m_fee = result["fee"].get(); // calculate fee! m_valuePos = changePos ? 0 : 1; - LOG_INFO() << "error: " << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << "result: " << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << "error: " << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << "result: " << result.dump(JSON_FORMAT_INDENT) << "\n"; // signrawtransaction m_rpcClient->CallRPC("signrawtransactionwithwallet", { "\"" + hexTx + "\"" }, BIND_THIS_MEMFN(OnSignRawContactTx)); @@ -319,8 +319,8 @@ void AtomicSwapHelper::OnSignRawContactTx(const json& reply) const auto& result = reply["result"]; auto hexTx = result["hex"].get(); - LOG_INFO() << "error: " << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << "result: " << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << "error: " << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << "result: " << result.dump(JSON_FORMAT_INDENT) << "\n"; // sendrawtransaction m_rpcClient->CallRPC("sendrawtransaction", { "\"" + hexTx + "\"" }, BIND_THIS_MEMFN(OnSendContractTx)); @@ -331,8 +331,8 @@ void AtomicSwapHelper::OnSendContractTx(const json& reply) // Parse reply const auto& error = reply["error"]; const auto& result = reply["result"]; - LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; } void AtomicSwapHelper::CreateRefundTx(const std::string& withdrawAddress @@ -356,8 +356,8 @@ void AtomicSwapHelper::OnCreateRawRefundTx(const json& reply) const auto& error = reply["error"]; const auto& result = reply["result"]; - LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; libbitcoin::data_chunk tx_data; libbitcoin::decode_base16(tx_data, result.get()); @@ -372,8 +372,8 @@ void AtomicSwapHelper::OnDumpSenderPrivateKey(const json& reply) const auto& error = reply["error"]; const auto& result = reply["result"]; - LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; libbitcoin::wallet::ec_private wallet_key(result.get(), libbitcoin::wallet::ec_private::testnet_wif); libbitcoin::endorsement sig; @@ -422,8 +422,8 @@ void AtomicSwapHelper::OnCreateRawRedeemTx(const json& reply) const auto& error = reply["error"]; const auto& result = reply["result"]; - LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; libbitcoin::data_chunk tx_data; libbitcoin::decode_base16(tx_data, result.get()); @@ -438,8 +438,8 @@ void AtomicSwapHelper::OnDumpReceiverPrivateKey(const json& reply) const auto& error = reply["error"]; const auto& result = reply["result"]; - LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; - LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << error.dump(JSON_FORMAT_INDENT) << "\n"; + BEAM_LOG_INFO() << result.dump(JSON_FORMAT_INDENT) << "\n"; libbitcoin::wallet::ec_private wallet_key(result.get(), libbitcoin::wallet::ec_private::testnet_wif); libbitcoin::endorsement sig; @@ -544,9 +544,9 @@ void testAtomicSwap(const boost::program_options::variables_map& vm) } int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); diff --git a/3rdparty/libbitcoin/examples/electrum_get_balance.cpp b/3rdparty/libbitcoin/examples/electrum_get_balance.cpp index cc7818934..99fc0201f 100644 --- a/3rdparty/libbitcoin/examples/electrum_get_balance.cpp +++ b/3rdparty/libbitcoin/examples/electrum_get_balance.cpp @@ -45,7 +45,7 @@ namespace void on_connected(uint64_t tag, std::unique_ptr&& newStream, ErrorCode status) { - LOG_INFO() << "on_connected"; + BEAM_LOG_INFO() << "on_connected"; if (newStream) { assert(status == EC_OK); newStream->enable_read(on_recv); @@ -70,17 +70,17 @@ namespace } } - LOG_INFO() << reverseHash; + BEAM_LOG_INFO() << reverseHash; std::string request = R"({"method":"blockchain.scripthash.get_balance","params":[")" + reverseHash +R"("], "id": "teste"})"; request += "\n"; - LOG_INFO() << request; + BEAM_LOG_INFO() << request; Result res = newStream->write(request.data(), request.size()); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } - LOG_INFO() << "after write"; + BEAM_LOG_INFO() << "after write"; streams.emplace_back(move(newStream)); } else { @@ -91,9 +91,9 @@ namespace } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); @@ -114,7 +114,7 @@ int main() { reactor->run(); } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return 0; diff --git a/3rdparty/libbitcoin/examples/get_info.cpp b/3rdparty/libbitcoin/examples/get_info.cpp index b7e166784..aff77f2dc 100644 --- a/3rdparty/libbitcoin/examples/get_info.cpp +++ b/3rdparty/libbitcoin/examples/get_info.cpp @@ -32,9 +32,9 @@ const uint16_t PORT = 18443; } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); @@ -66,13 +66,13 @@ int main() { request.body(data, strlen(data)); request.callback([&reactor](uint64_t id, const HttpMsgReader::Message& msg) -> bool { - LOG_INFO() << "response from " << id; + BEAM_LOG_INFO() << "response from " << id; size_t sz = 0; const void* body = msg.msg->get_body(sz); json j = json::parse(std::string(static_cast(body), sz)); - LOG_INFO() << j; - LOG_INFO() << j["result"]["headers"]; + BEAM_LOG_INFO() << j; + BEAM_LOG_INFO() << j["result"]["headers"]; reactor->stop(); return false; }); @@ -83,7 +83,7 @@ int main() { reactor->run(); } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return 0; diff --git a/android/dao/apps_api_ui.cpp b/android/dao/apps_api_ui.cpp index dea5c8b0b..d63df614e 100644 --- a/android/dao/apps_api_ui.cpp +++ b/android/dao/apps_api_ui.cpp @@ -35,37 +35,37 @@ int AppsApiUI::test() void AppsApiUI::sendApproved(const std::string& request) { - LOG_INFO() << "Contract send approved: " << getAppName() << ", " << getAppId() << ", " << request; + BEAM_LOG_INFO() << "Contract send approved: " << getAppName() << ", " << getAppId() << ", " << request; AnyThread_callWalletApiDirectly(request); } void AppsApiUI::sendRejected(const std::string& request) { - LOG_INFO() << "Contract send rejected: " << getAppName() << ", " << getAppId() << ", " << request; + BEAM_LOG_INFO() << "Contract send rejected: " << getAppName() << ", " << getAppId() << ", " << request; AnyThread_sendApiError(request, beam::wallet::ApiError::UserRejected, std::string()); } void AppsApiUI::contractInfoApproved(const std::string& request) { - LOG_INFO() << "Contract tx approved: " << getAppName() << ", " << getAppId() << ", " << request; + BEAM_LOG_INFO() << "Contract tx approved: " << getAppName() << ", " << getAppId() << ", " << request; AnyThread_callWalletApiDirectly(request); } void AppsApiUI::contractInfoRejected(const std::string& request) { - LOG_INFO() << "Contract tx rejected: " << getAppName() << ", " << getAppId() << ", " << request; + BEAM_LOG_INFO() << "Contract tx rejected: " << getAppName() << ", " << getAppId() << ", " << request; AnyThread_sendApiError(request, beam::wallet::ApiError::UserRejected, std::string()); } void AppsApiUI::callWalletApi(const std::string& request) { - LOG_INFO() << "Call Wallet Api: " << getAppName() << ", " << getAppId() << ", " << request; + BEAM_LOG_INFO() << "Call Wallet Api: " << getAppName() << ", " << getAppId() << ", " << request; AnyThread_callWalletApiChecked(request); } void AppsApiUI::AnyThread_sendApiResponse(std::string&& result) { - LOG_INFO() << "Send Api Response: " << getAppName() << ", " << getAppId() << ", " << result; + BEAM_LOG_INFO() << "Send Api Response: " << getAppName() << ", " << getAppId() << ", " << result; JNIEnv* env = Android_JNI_getEnv(); diff --git a/android/dao/web_api_creator.cpp b/android/dao/web_api_creator.cpp index 466ebbc83..595a76fef 100644 --- a/android/dao/web_api_creator.cpp +++ b/android/dao/web_api_creator.cpp @@ -45,7 +45,7 @@ void WebAPICreator::createApi(WalletModel::Ptr walletModel, const std::string& v } else { - LOG_INFO() << "WebAPICreator destroyed before api created:" << version << ", " << appName << ", " << appid; + BEAM_LOG_INFO() << "WebAPICreator destroyed before api created:" << version << ", " << appName << ", " << appid; } }); } diff --git a/android/jni.cpp b/android/jni.cpp index 784b42cee..715e148f0 100644 --- a/android/jni.cpp +++ b/android/jni.cpp @@ -81,12 +81,12 @@ namespace { wallet::g_AssetsEnabled = true; - static auto logger = Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, "wallet_", (fs::path(appData) / fs::path("logs")).string()); + static auto logger = Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, "wallet_", (fs::path(appData) / fs::path("logs")).string()); Rules::get().UpdateChecksum(); - LOG_INFO() << "Beam Mobile Wallet " << appVersion << " (" << BRANCH_NAME << ") library: " << PROJECT_VERSION; - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Beam Mobile Wallet " << appVersion << " (" << BRANCH_NAME << ") library: " << PROJECT_VERSION; + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); } std::map initNotifications(bool initialValue) @@ -363,7 +363,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(createWallet)(JNIEnv *env, job if (!isValidMnemonic(phrases)) { - LOG_ERROR() << "Invalid seed phrase provided: " << st; + BEAM_LOG_ERROR() << "Invalid seed phrase provided: " << st; return nullptr; } @@ -423,7 +423,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(createWallet)(JNIEnv *env, job return walletObj; } - LOG_ERROR() << "wallet creation error."; + BEAM_LOG_ERROR() << "wallet creation error."; return nullptr; } @@ -497,7 +497,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(openWallet)(JNIEnv *env, jobje return walletObj; } - LOG_ERROR() << "wallet not opened."; + BEAM_LOG_ERROR() << "wallet not opened."; return nullptr; } @@ -613,7 +613,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(sendTransaction)(JNIEnv *env, auto txParameters = beam::wallet::ParseParameters(address); if (!txParameters) { - LOG_ERROR() << "Receiver Address is not valid!!!"; + BEAM_LOG_ERROR() << "Receiver Address is not valid!!!"; return; } @@ -761,7 +761,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(updateAddress)(JNIEnv *env, jo if (!walletID.FromHex(JString(env, addr).value())) { - LOG_ERROR() << "Address is not valid!!!"; + BEAM_LOG_ERROR() << "Address is not valid!!!"; return; } @@ -782,7 +782,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(updateAddress)(JNIEnv *env, jo expirationStatus = WalletAddress::ExpirationStatus::AsIs; break; default: - LOG_ERROR() << "Address expiration is not valid!!!"; + BEAM_LOG_ERROR() << "Address expiration is not valid!!!"; return; } @@ -796,7 +796,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddressChanges)(JNIEnv *en if (!walletID.FromHex(JString(env, addr).value())) { - LOG_ERROR() << "Address is not valid!!!"; + BEAM_LOG_ERROR() << "Address is not valid!!!"; return; } @@ -809,7 +809,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddressChanges)(JNIEnv *en expirationStatus = WalletAddress::ExpirationStatus::Expired; else { - LOG_ERROR() << "Address expiration is not valid!!!"; + BEAM_LOG_ERROR() << "Address expiration is not valid!!!"; return; } @@ -847,7 +847,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(deleteAddress)(JNIEnv *env, jo WalletID id(Zero); if (!id.FromHex(JString(env, walletID).value())) { - LOG_ERROR() << "Address is not valid!!!"; + BEAM_LOG_ERROR() << "Address is not valid!!!"; return; } walletModel->getAsync()->deleteAddress(id); @@ -985,7 +985,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(switchOnOffNotifications)(JNIE if (notificationTypeEnum <= static_cast(Notification::Type::SoftwareUpdateAvailable) || notificationTypeEnum > static_cast(Notification::Type::TransactionCompleted)) { - LOG_ERROR() << "Notification type is not valid!!!"; + BEAM_LOG_ERROR() << "Notification type is not valid!!!"; } walletModel->getAsync()->switchOnOffNotifications(static_cast(notificationTypeEnum), isActive); diff --git a/beam/cli.cpp b/beam/cli.cpp index 157eb5aa5..cb2fcbbbe 100644 --- a/beam/cli.cpp +++ b/beam/cli.cpp @@ -95,7 +95,7 @@ namespace { std::stringstream ss; ss << "Websocket proxy failed to read, code=" << io::error_str(errorCode); - LOG_ERROR() << ss.str(); + BEAM_LOG_ERROR() << ss.str(); m_wsClose(ss.str()); return false; } @@ -108,7 +108,7 @@ namespace { std::stringstream ss; ss << "Websocket proxy failed connected to the node: " << io::error_str(errorCode); - LOG_ERROR() << ss.str(); + BEAM_LOG_ERROR() << ss.str(); m_wsClose(ss.str()); } } @@ -206,7 +206,7 @@ namespace { var = vm[deprecatedName]; if (!var.empty()) - LOG_WARNING() << "The \"" << deprecatedName << "\"" << " parameter is deprecated, use " << "\"" << name << "\" instead."; + BEAM_LOG_WARNING() << "The \"" << deprecatedName << "\"" << " parameter is deprecated, use " << "\"" << name << "\" instead."; } if (!var.empty()) { @@ -249,7 +249,7 @@ class NodeObserver : public Node::IObserver s.m_Done >>= 1; } int p = static_cast((s.m_Done * 100) / s.m_Total); - LOG_INFO() << "Updating node: " << p << "% (" << s.m_Done << "/" << s.m_Total << ")"; + BEAM_LOG_INFO() << "Updating node: " << p << "% (" << s.m_Done << "/" << s.m_Total << ")"; } Node* m_pNode; @@ -314,8 +314,8 @@ int main(int argc, char* argv[]) return 0; } - int logLevel = getLogLevel(cli::LOG_LEVEL, vm, LOG_LEVEL_DEBUG); - int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, LOG_LEVEL_DEBUG); + int logLevel = getLogLevel(cli::LOG_LEVEL, vm, BEAM_LOG_LEVEL_DEBUG); + int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, BEAM_LOG_LEVEL_DEBUG); #define LOG_FILES_DIR "logs" #define LOG_FILES_PREFIX "node_" @@ -332,14 +332,14 @@ int main(int argc, char* argv[]) clean_old_logfiles(LOG_FILES_DIR, LOG_FILES_PREFIX, logCleanupPeriod); Rules::get().UpdateChecksum(); - LOG_INFO() << "Beam Node " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Beam Node " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); auto port = vm[cli::PORT].as(); if (!port) { - LOG_ERROR() << "Port must be specified"; + BEAM_LOG_ERROR() << "Port must be specified"; return -1; } @@ -413,7 +413,7 @@ int main(int argc, char* argv[]) SecString pass; if (!beam::read_wallet_pass(pass, vm)) { - LOG_ERROR() << "Please, provide password for the keys."; + BEAM_LOG_ERROR() << "Please, provide password for the keys."; return -1; } @@ -492,7 +492,7 @@ int main(int argc, char* argv[]) { if (!addr.port()) { - LOG_WARNING() << "No port is specified for \"" << vPeers[i] << "\", the default value is " << port; + BEAM_LOG_WARNING() << "No port is specified for \"" << vPeers[i] << "\", the default value is " << port; addr.port(port); } @@ -500,13 +500,13 @@ int main(int argc, char* argv[]) } else { - LOG_ERROR() << "unable to resolve: " << vPeers[i]; + BEAM_LOG_ERROR() << "unable to resolve: " << vPeers[i]; } } node.m_Cfg.m_PeersPersistent = vm[cli::NODE_PEERS_PERSISTENT].as(); - LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; + BEAM_LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; if (vm.count(cli::TREASURY_BLOCK)) { @@ -516,7 +516,7 @@ int main(int argc, char* argv[]) else { if (!node.m_Cfg.m_Treasury.empty()) - LOG_INFO() << "Treasury size: " << node.m_Cfg.m_Treasury.size(); + BEAM_LOG_INFO() << "Treasury size: " << node.m_Cfg.m_Treasury.size(); } } @@ -586,9 +586,9 @@ int main(int argc, char* argv[]) if (vm.count(cli::GENERATE_RECOVERY_PATH)) { string sPath = vm[cli::GENERATE_RECOVERY_PATH].as(); - LOG_INFO() << "Writing recovery info..."; + BEAM_LOG_INFO() << "Writing recovery info..."; node.GenerateRecoveryInfo(sPath.c_str()); - LOG_INFO() << "Recovery info written"; + BEAM_LOG_INFO() << "Recovery info written"; } if (vm.count(cli::RECOVERY_AUTO_PATH)) @@ -647,12 +647,12 @@ int main(int argc, char* argv[]) } catch (const po::error& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); printHelp(visibleOptions); } catch (const std::runtime_error& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } catch (const std::exception& e) diff --git a/bvm/ethash_service/ethash_service.cpp b/bvm/ethash_service/ethash_service.cpp index 580b75460..e9def5458 100644 --- a/bvm/ethash_service/ethash_service.cpp +++ b/bvm/ethash_service/ethash_service.cpp @@ -219,7 +219,7 @@ int main(int argc, char* argv[]) try { const auto path = boost::filesystem::system_complete("./logs"); - auto logger = beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, "", path.string()); + auto logger = beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, "", path.string()); MyOptions options; po::options_description desc("Ethash service options"); desc.add_options() @@ -278,6 +278,6 @@ int main(int argc, char* argv[]) } catch (const std::exception& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); } } diff --git a/core/block_crypt.cpp b/core/block_crypt.cpp index 21eb9860e..1336c5733 100644 --- a/core/block_crypt.cpp +++ b/core/block_crypt.cpp @@ -3178,7 +3178,7 @@ namespace beam { m_Total = nTotal; m_Last_ms = GetTime_ms(); - LOG_INFO() << sz; + BEAM_LOG_INFO() << sz; if (m_pExternal) m_pExternal->Reset(sz, nTotal); } @@ -3210,7 +3210,7 @@ namespace beam nDone = (uint32_t) (pos * 100ull / m_Total); } - LOG_INFO() << "\t" << nDone << "%..."; + BEAM_LOG_INFO() << "\t" << nDone << "%..."; } if (m_pExternal) return m_pExternal->OnProgress(pos); diff --git a/core/peer_manager.cpp b/core/peer_manager.cpp index f08a670a2..866acbc22 100644 --- a/core/peer_manager.cpp +++ b/core/peer_manager.cpp @@ -194,7 +194,7 @@ PeerManager::PeerInfo* PeerManager::Find(const PeerID& id, bool& bCreate) ret->m_LastConnectAttempt = 0; ret->m_LastActivity_ms = 0; - LOG_VERBOSE() << *ret << " New"; + BEAM_LOG_VERBOSE() << *ret << " New"; return ret; } @@ -247,7 +247,7 @@ void PeerManager::SetRatingInternal(PeerInfo& pi, uint32_t val, bool ban) m_Ratings.insert(pi.m_RawRating); - LOG_VERBOSE() << pi << " Rating " << r0 << " -> " << pi.m_RawRating.m_Value << ", =" << Rating::ToBps(pi.m_RawRating.m_Value); + BEAM_LOG_VERBOSE() << pi << " Rating " << r0 << " -> " << pi.m_RawRating.m_Value << ", =" << Rating::ToBps(pi.m_RawRating.m_Value); } void PeerManager::RemoveAddr(PeerInfo& pi) @@ -265,7 +265,7 @@ void PeerManager::ModifyAddr(PeerInfo& pi, const io::Address& addr) if (addr == pi.m_Addr.m_Value) return; - LOG_VERBOSE() << pi << " Address changed to " << addr; + BEAM_LOG_VERBOSE() << pi << " Address changed to " << addr; RemoveAddr(pi); diff --git a/core/proto.cpp b/core/proto.cpp index 7d97dc5b0..bc04769a5 100644 --- a/core/proto.cpp +++ b/core/proto.cpp @@ -721,7 +721,7 @@ void NodeConnection::OnMsg(Login&& msg) Height hScheme = pFork[1].m_Height; - LOG_WARNING() << "Peer " << m_Connection->peer_address() << " incompatible with HF " << (nMyFork + 1) << ", Height=" << hScheme; + BEAM_LOG_WARNING() << "Peer " << m_Connection->peer_address() << " incompatible with HF " << (nMyFork + 1) << ", Height=" << hScheme; Height hMinScheme = get_MinPeerFork(); if (hMinScheme >= hScheme) @@ -730,7 +730,7 @@ void NodeConnection::OnMsg(Login&& msg) if (i + 1 != msg.m_Cfgs.size()) { - LOG_WARNING() << "Peer " << m_Connection->peer_address() << " has unknown fork: " << msg.m_Cfgs[i + 1]; + BEAM_LOG_WARNING() << "Peer " << m_Connection->peer_address() << " has unknown fork: " << msg.m_Cfgs[i + 1]; } OnLoginInternal(std::move(msg)); @@ -767,7 +767,7 @@ void NodeConnection::OnLoginInternal(Login&& msg) if (LoginFlags::Extension::Maximum != nExt) { bool bNewer = (nExt > LoginFlags::Extension::Maximum); - LOG_WARNING() << "Peer " << m_Connection->peer_address() << " uses " << (bNewer ? "newer" : "older") << " ext: " << nExt; + BEAM_LOG_WARNING() << "Peer " << m_Connection->peer_address() << " uses " << (bNewer ? "newer" : "older") << " ext: " << nExt; if (nExt < LoginFlags::Extension::Minimum) ThrowUnexpected("Legacy", NodeProcessingException::Type::Incompatible); diff --git a/explorer/adapter.cpp b/explorer/adapter.cpp index fabaf7ac5..624dde0bc 100644 --- a/explorer/adapter.cpp +++ b/explorer/adapter.cpp @@ -164,7 +164,7 @@ class ExchangeRateProvider } catch(...) { - LOG_WARNING() << "broadcast message processing exception"; + BEAM_LOG_WARNING() << "broadcast message processing exception"; return false; } } @@ -2620,7 +2620,7 @@ class Adapter : public Node::IObserver, public IAdapter { wbtcAmount += offer.amountSwapCoin(); break; default : - LOG_ERROR() << "Unknown swap coin type"; + BEAM_LOG_ERROR() << "Unknown swap coin type"; return false; } } diff --git a/explorer/explorer_node.cpp b/explorer/explorer_node.cpp index 8e3b9232b..41d22d782 100644 --- a/explorer/explorer_node.cpp +++ b/explorer/explorer_node.cpp @@ -51,7 +51,7 @@ int main(int argc, char* argv[]) { } const auto path = boost::filesystem::system_complete(LOG_FILES_DIR); - auto logger = Logger::create(LOG_LEVEL_INFO, options.logLevel, options.logLevel, FILES_PREFIX, path.string()); + auto logger = Logger::create(BEAM_LOG_LEVEL_INFO, options.logLevel, options.logLevel, FILES_PREFIX, path.string()); clean_old_logfiles(LOG_FILES_DIR, FILES_PREFIX, options.logCleanupPeriod); @@ -70,18 +70,18 @@ int main(int argc, char* argv[]) { node.Initialize(); adapter->Initialize(); explorer::Server server(*adapter, *reactor, options.explorerListenTo, options.accessControlFile, options.whitelist); - LOG_INFO() << "Node listens to " << options.nodeListenTo << ", explorer listens to " << options.explorerListenTo; + BEAM_LOG_INFO() << "Node listens to " << options.nodeListenTo << ", explorer listens to " << options.explorerListenTo; reactor->run(); - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } catch (const std::exception& e) { - LOG_ERROR() << "EXCEPTION: " << e.what(); + BEAM_LOG_ERROR() << "EXCEPTION: " << e.what(); retCode = 255; } catch (const beam::CorruptionException& e) { - LOG_ERROR() << "Corruption: " << e.m_sErr; + BEAM_LOG_ERROR() << "Corruption: " << e.m_sErr; retCode = 255; } catch (...) { - LOG_ERROR() << "NON_STD EXCEPTION"; + BEAM_LOG_ERROR() << "NON_STD EXCEPTION"; retCode = 255; } return retCode; @@ -109,9 +109,9 @@ bool parse_cmdline(int argc, char* argv[], Options& o) { cliOptions.add(createRulesOptionsDescription()); #ifdef NDEBUG - o.logLevel = LOG_LEVEL_INFO; + o.logLevel = BEAM_LOG_LEVEL_INFO; #else - o.logLevel = LOG_LEVEL_DEBUG; + o.logLevel = BEAM_LOG_LEVEL_DEBUG; #endif @@ -227,8 +227,8 @@ bool parse_cmdline(int argc, char* argv[], Options& o) { void setup_node(Node& node, const Options& o) { Rules::get().UpdateChecksum(); - LOG_INFO() << "Beam Node Explorer " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Beam Node Explorer " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); node.m_Cfg.m_sPathLocal = o.nodeDbFilename; node.m_Cfg.m_Listen.port(o.nodeListenTo.port()); diff --git a/explorer/server.cpp b/explorer/server.cpp index e827f6b31..28369b1dd 100644 --- a/explorer/server.cpp +++ b/explorer/server.cpp @@ -54,9 +54,9 @@ void Server::start_server() { _bindAddress, BIND_THIS_MEMFN(on_stream_accepted) ); - LOG_INFO() << STS << "listens to " << _bindAddress; + BEAM_LOG_INFO() << STS << "listens to " << _bindAddress; } catch (const std::exception& e) { - LOG_ERROR() << STS << "cannot start server: " << e.what() << " restarting in " << SERVER_RESTART_INTERVAL << " msec"; + BEAM_LOG_ERROR() << STS << "cannot start server: " << e.what() << " restarting in " << SERVER_RESTART_INTERVAL << " msec"; _timers.set_timer(SERVER_RESTART_TIMER, SERVER_RESTART_INTERVAL, BIND_THIS_MEMFN(start_server)); } } @@ -75,7 +75,7 @@ void Server::on_stream_accepted(io::TcpStream::Ptr&& newStream, io::ErrorCode er { if (std::find(_whitelist.begin(), _whitelist.end(), peer.ip()) == _whitelist.end()) { - LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; + BEAM_LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; return; } } @@ -91,7 +91,7 @@ void Server::on_stream_accepted(io::TcpStream::Ptr&& newStream, io::ErrorCode er std::move(newStream) ); } else { - LOG_ERROR() << STS << io::error_str(errorCode) << ", restarting server in " << SERVER_RESTART_INTERVAL << " msec"; + BEAM_LOG_ERROR() << STS << io::error_str(errorCode) << ", restarting server in " << SERVER_RESTART_INTERVAL << " msec"; _timers.set_timer(SERVER_RESTART_TIMER, SERVER_RESTART_INTERVAL, BIND_THIS_MEMFN(start_server)); } } @@ -865,7 +865,7 @@ bool Server::send(const HttpConnection::Ptr& conn, int code, const char* message } if (!result) ok = false; } else { - LOG_ERROR() << STS << "cannot create response"; + BEAM_LOG_ERROR() << STS << "cannot create response"; } _headers.clear(); @@ -903,7 +903,7 @@ void Server::IPAccessControl::refresh() { _ips.insert(a.ip()); } } catch (std::exception &e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } diff --git a/explorer/unittest/adapter_test.cpp b/explorer/unittest/adapter_test.cpp index 5f11f0459..22b48018d 100644 --- a/explorer/unittest/adapter_test.cpp +++ b/explorer/unittest/adapter_test.cpp @@ -58,12 +58,12 @@ WaitHandle run_node(const NodeParams& params) { } if (!params.treasuryPath.empty()) { wallet::ReadTreasury(node.m_Cfg.m_Treasury, params.treasuryPath); - LOG_INFO() << "Treasury blocks read: " << node.m_Cfg.m_Treasury.size(); + BEAM_LOG_INFO() << "Treasury blocks read: " << node.m_Cfg.m_Treasury.size(); } explorer::IAdapter::Ptr adapter = explorer::create_adapter(node); - LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; + BEAM_LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; node.Initialize(); reactor->run(); } @@ -107,9 +107,9 @@ int test_adapter(int seconds) { int main(int argc, char* argv[]) { using namespace beam; - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); logger->set_header_formatter( diff --git a/http/unittests/http_client_test.cpp b/http/unittests/http_client_test.cpp index bba7ec4e9..854a27d73 100644 --- a/http/unittests/http_client_test.cpp +++ b/http/unittests/http_client_test.cpp @@ -113,7 +113,7 @@ namespace { nErrors += (int)expected.size(); } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); nErrors = 255; } @@ -123,9 +123,9 @@ namespace { } //namespace int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); auto res = http_client_test(false); diff --git a/http/unittests/http_parser_test.cpp b/http/unittests/http_parser_test.cpp index 73b1c734a..579fabf53 100644 --- a/http/unittests/http_parser_test.cpp +++ b/http/unittests/http_parser_test.cpp @@ -40,7 +40,7 @@ struct FragmentedInput { }; int report(const char* fn, int errors) { - if (errors) { LOG_ERROR() << fn << " " << errors << " errors"; } + if (errors) { BEAM_LOG_ERROR() << fn << " " << errors << " errors"; } else { LOG_DEBUG() << fn << " ok"; } return errors; } @@ -232,7 +232,7 @@ int test_query_strings() { if (!a.parse(q, dirs)) ++n; \ else n = compare(a,b); \ if ((n>0 && shouldBeValid) || (n==0 && !shouldBeValid)) { \ - LOG_ERROR() << "compare failed, n=" << n << " " << __LINE__; errors += n; \ + BEAM_LOG_ERROR() << "compare failed, n=" << n << " " << __LINE__; errors += n; \ }} while(0) int errors = 0; @@ -264,7 +264,7 @@ int test_query_strings() { q = "/xxx/1/2/3/4/5/6/7/8/9/0/1/2/3/4/5/6/7?a=1111&b=22kkkk&cccc&dddd=qqqq#cbcbcb"; static_assert(HttpUrl::MAX_PATH_ELEMENTS <= 15); if (parsed.parse(q, dirs)) { - LOG_ERROR() << + BEAM_LOG_ERROR() << ++errors; } @@ -280,9 +280,9 @@ int test_query_strings() { } //namespace int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); int retCode = 0; @@ -293,10 +293,10 @@ int main() { retCode += test_chunked(); retCode += test_query_strings(); } catch (const exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); retCode = 255; } catch (...) { - LOG_ERROR() << "non-std exception"; + BEAM_LOG_ERROR() << "non-std exception"; retCode = 255; } return retCode; diff --git a/http/unittests/http_test.cpp b/http/unittests/http_test.cpp index b3095df5f..b259d633b 100644 --- a/http/unittests/http_test.cpp +++ b/http/unittests/http_test.cpp @@ -62,14 +62,14 @@ class DummyHttpServer { std::move(newStream) ); } else { - LOG_ERROR() << "Server error " << io::error_str(errorCode); + BEAM_LOG_ERROR() << "Server error " << io::error_str(errorCode); g_stopEvent(); } } bool on_request(uint64_t, const HttpMsgReader::Message& msg) { if (msg.what != HttpMsgReader::http_message || !msg.msg) { - LOG_ERROR() << "Request error"; + BEAM_LOG_ERROR() << "Request error"; g_stopEvent(); return false; } @@ -110,7 +110,7 @@ class DummyHttpServer { _theConnection->write_msg(_serialized); _theConnection->shutdown(); } else { - LOG_ERROR() << "Cannot create response"; + BEAM_LOG_ERROR() << "Cannot create response"; g_stopEvent(); } @@ -145,14 +145,14 @@ class DummyHttpClient { private: void on_timer() { if (!_reactor.tcp_connect(io::Address::localhost().port(PORT), 333, BIND_THIS_MEMFN(on_connected), 1000, io::TlsConfig(_ssl, false))) { - LOG_ERROR() << "Connect failed"; + BEAM_LOG_ERROR() << "Connect failed"; g_stopEvent(); } } void on_connected(uint64_t, io::TcpStream::Ptr&& newStream, io::ErrorCode errorCode) { if (errorCode != 0) { - LOG_ERROR() << "Connect failed, " << io::error_str(errorCode); + BEAM_LOG_ERROR() << "Connect failed, " << io::error_str(errorCode); g_stopEvent(); return; } @@ -179,14 +179,14 @@ class DummyHttpClient { _theConnection->write_msg(_serialized); _serialized.clear(); } else { - LOG_ERROR() << "Cannot send request"; + BEAM_LOG_ERROR() << "Cannot send request"; g_stopEvent(); } } bool on_response(uint64_t, const HttpMsgReader::Message& msg) { if (msg.what != HttpMsgReader::http_message || !msg.msg) { - LOG_ERROR() << __FUNCTION__ << " " << msg.error_str(); + BEAM_LOG_ERROR() << __FUNCTION__ << " " << msg.error_str(); if (msg.what == HttpMsgReader::connection_error && msg.connectionError == io::EC_EOF) { _theConnection.reset(); @@ -204,12 +204,12 @@ class DummyHttpClient { io::SharedBuffer fileContent = io::map_file_read_only(THIS_PATH.c_str()); if (fileContent.size == bodySize && !memcmp(body, fileContent.data, bodySize)) { uncompleted = 0; - LOG_INFO() << "file received successfully, size=" << bodySize; + BEAM_LOG_INFO() << "file received successfully, size=" << bodySize; } else { - LOG_INFO() << "file receive error" << TRACE(bodySize) << TRACE(fileContent.size); + BEAM_LOG_INFO() << "file receive error" << TRACE(bodySize) << TRACE(fileContent.size); } } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } @@ -252,7 +252,7 @@ int http_server_test(bool ssl) { nErrors = client.uncompleted; LOG_DEBUG() << reactor.use_count(); } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); nErrors = 255; } @@ -263,9 +263,9 @@ int http_server_test(bool ssl) { } //namespace int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); int r = http_server_test(true); diff --git a/keykeeper/trezor_key_keeper.cpp b/keykeeper/trezor_key_keeper.cpp index 37236fe24..dc637a9b8 100644 --- a/keykeeper/trezor_key_keeper.cpp +++ b/keykeeper/trezor_key_keeper.cpp @@ -230,12 +230,12 @@ namespace beam::wallet //onError(message); - LOG_ERROR() << "TREZOR FAIL REASON: " << message; + BEAM_LOG_ERROR() << "TREZOR FAIL REASON: " << message; }); trezor->callback_Success([&](const Message& msg, std::string session, size_t queue_size) { - LOG_INFO() << "TREZOR SUCCESS: " << child_cast(msg).message(); + BEAM_LOG_INFO() << "TREZOR SUCCESS: " << child_cast(msg).message(); }); try @@ -244,7 +244,7 @@ namespace beam::wallet } catch (std::runtime_error e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); return nullptr; } } diff --git a/node/db.cpp b/node/db.cpp index 8fdc27cbe..63f507edc 100644 --- a/node/db.cpp +++ b/node/db.cpp @@ -395,7 +395,7 @@ void NodeDB::Open(const char* szPath) case 18: // ridiculous rating values, no States.Inputs column, Txo.SpendHeight is still indexed - LOG_INFO() << "DB migrate from " << 18; + BEAM_LOG_INFO() << "DB migrate from " << 18; MigrateFrom18(); // no break; @@ -406,7 +406,7 @@ void NodeDB::Open(const char* szPath) case 20: // Deprecated Shielded table created. CreateTables20(); - LOG_INFO() << "DB migrate from " << 20; + BEAM_LOG_INFO() << "DB migrate from " << 20; MigrateFrom20(); // no break; @@ -2996,7 +2996,7 @@ void NodeDB::AssetSetValue(Asset::ID id, const AmountBig::Type& val, Height hLoc void NodeDB::MigrateFrom18() { { - LOG_INFO() << "Resetting peer ratings..."; + BEAM_LOG_INFO() << "Resetting peer ratings..."; std::vector v; diff --git a/node/functionaltests/check_mined_test.cpp b/node/functionaltests/check_mined_test.cpp index 7a5f6e538..a700f24f8 100644 --- a/node/functionaltests/check_mined_test.cpp +++ b/node/functionaltests/check_mined_test.cpp @@ -57,26 +57,26 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; m_IsInit = true; - LOG_INFO() << "Send GetMined message"; + BEAM_LOG_INFO() << "Send GetMined message"; Send(proto::GetMined{ msg.m_Description.m_Height - 1000 }); } } void TestNodeConnection::OnMsg(proto::Mined&& msg) { - LOG_INFO() << "Mined"; + BEAM_LOG_INFO() << "Mined"; if (!msg.m_Entries.empty()) { - LOG_INFO() << "Ok: list is not empty"; + BEAM_LOG_INFO() << "Ok: list is not empty"; } else { - LOG_INFO() << "Failed: list is empty"; + BEAM_LOG_INFO() << "Failed: list is empty"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -94,11 +94,11 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) { if (isOk) { - LOG_INFO() << "OK: utxo is valid"; + BEAM_LOG_INFO() << "OK: utxo is valid"; } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; } @@ -109,7 +109,7 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/double_spending_2_tx_test.cpp b/node/functionaltests/double_spending_2_tx_test.cpp index 58f0babde..fac88f355 100644 --- a/node/functionaltests/double_spending_2_tx_test.cpp +++ b/node/functionaltests/double_spending_2_tx_test.cpp @@ -63,7 +63,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -91,11 +91,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Ok: utxo is valid"; + BEAM_LOG_INFO() << "Ok: utxo is valid"; } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; } } @@ -106,11 +106,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Failed: utxo is valid"; + BEAM_LOG_INFO() << "Failed: utxo is valid"; } else { - LOG_INFO() << "Ok: utxo is not valid"; + BEAM_LOG_INFO() << "Ok: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -122,11 +122,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -138,7 +138,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/double_spending_test.cpp b/node/functionaltests/double_spending_test.cpp index bcbbf4286..4ef4eac53 100644 --- a/node/functionaltests/double_spending_test.cpp +++ b/node/functionaltests/double_spending_test.cpp @@ -60,7 +60,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -83,11 +83,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Failed: utxo is valid"; + BEAM_LOG_INFO() << "Failed: utxo is valid"; } else { - LOG_INFO() << "Ok: utxo is not valid"; + BEAM_LOG_INFO() << "Ok: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -99,11 +99,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -115,7 +115,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/experiment_with_sieze_tx_test.cpp b/node/functionaltests/experiment_with_sieze_tx_test.cpp index 1905cc0a0..bb3fccebf 100644 --- a/node/functionaltests/experiment_with_sieze_tx_test.cpp +++ b/node/functionaltests/experiment_with_sieze_tx_test.cpp @@ -22,7 +22,7 @@ using namespace ECC; int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); HKdf kdf; @@ -53,5 +53,5 @@ int main(int argc, char* argv[]) SerializerSizeCounter ssc; ssc & generator.GetTransaction().m_Transaction; - LOG_INFO() << "size = " << ssc.m_Counter.m_Value; + BEAM_LOG_INFO() << "size = " << ssc.m_Counter.m_Value; } \ No newline at end of file diff --git a/node/functionaltests/fraction_coin_test.cpp b/node/functionaltests/fraction_coin_test.cpp index 4202538bc..2135d9726 100644 --- a/node/functionaltests/fraction_coin_test.cpp +++ b/node/functionaltests/fraction_coin_test.cpp @@ -66,7 +66,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -82,7 +82,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) m_Generator.Sort(); - LOG_INFO() << "Is valid = " << m_Generator.IsValid(); + BEAM_LOG_INFO() << "Is valid = " << m_Generator.IsValid(); Send(m_Generator.GetTransaction()); } @@ -96,11 +96,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Everythink is Ok"; + BEAM_LOG_INFO() << "Everythink is Ok"; } else { - LOG_INFO() << "Everythink is Failed"; + BEAM_LOG_INFO() << "Everythink is Failed"; } io::Reactor::get_Current().stop(); } @@ -112,11 +112,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed:"; + BEAM_LOG_INFO() << "Failed:"; m_Failed = true; io::Reactor::get_Current().stop(); return; @@ -127,7 +127,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_big_tx_test.cpp b/node/functionaltests/send_big_tx_test.cpp index 2c58df560..578300b8e 100644 --- a/node/functionaltests/send_big_tx_test.cpp +++ b/node/functionaltests/send_big_tx_test.cpp @@ -42,7 +42,7 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) void TestNodeConnection::OnDisconnect(const DisconnectReason&) { - LOG_INFO() << "Ok: connection is reset"; + BEAM_LOG_INFO() << "Ok: connection is reset"; io::Reactor::get_Current().stop(); } @@ -50,7 +50,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Generate transaction"; + BEAM_LOG_INFO() << "Generate transaction"; TxGenerator gen(*m_pKdf); Amount amount = 20000; @@ -69,14 +69,14 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "Send big transaction"; + BEAM_LOG_INFO() << "Send big transaction"; Send(gen.GetTransaction()); }); } int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_broken_new_tx_test.cpp b/node/functionaltests/send_broken_new_tx_test.cpp index 6633b3fd5..0658d536f 100644 --- a/node/functionaltests/send_broken_new_tx_test.cpp +++ b/node/functionaltests/send_broken_new_tx_test.cpp @@ -38,7 +38,7 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) void TestNodeConnection::OnDisconnect(const DisconnectReason&) { - LOG_INFO() << "Ok: connection is reset"; + BEAM_LOG_INFO() << "Ok: connection is reset"; io::Reactor::get_Current().stop(); } @@ -46,7 +46,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Send message NewTransaction without transaction"; + BEAM_LOG_INFO() << "Send message NewTransaction without transaction"; proto::NewTransaction msg; Send(msg); @@ -55,7 +55,7 @@ void TestNodeConnection::GenerateTests() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_data_missing_test.cpp b/node/functionaltests/send_data_missing_test.cpp index 473f57ab4..44a509959 100644 --- a/node/functionaltests/send_data_missing_test.cpp +++ b/node/functionaltests/send_data_missing_test.cpp @@ -34,7 +34,7 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) void TestNodeConnection::OnDisconnect(const DisconnectReason&) { - LOG_INFO() << "Ok: connection is reset"; + BEAM_LOG_INFO() << "Ok: connection is reset"; io::Reactor::get_Current().stop(); } @@ -42,14 +42,14 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Send DataMissing message"; + BEAM_LOG_INFO() << "Send DataMissing message"; Send(proto::DataMissing(Zero)); }); } int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_empty_kernels_test.cpp b/node/functionaltests/send_empty_kernels_test.cpp index 03dd774c2..a22c425e7 100644 --- a/node/functionaltests/send_empty_kernels_test.cpp +++ b/node/functionaltests/send_empty_kernels_test.cpp @@ -40,7 +40,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Run test with empty kernel"; + BEAM_LOG_INFO() << "Run test with empty kernel"; TxGenerator gen(*m_pKdf); @@ -61,7 +61,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with normal and empty kernels"; + BEAM_LOG_INFO() << "Run test with normal and empty kernels"; TxGenerator gen(*m_pKdf); @@ -86,7 +86,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with 2 empty kernels"; + BEAM_LOG_INFO() << "Run test with 2 empty kernels"; TxGenerator gen(*m_pKdf); @@ -108,7 +108,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test without kernels"; + BEAM_LOG_INFO() << "Run test without kernels"; TxGenerator gen(*m_pKdf); @@ -120,7 +120,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid = " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid = " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -128,7 +128,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with kernel without input and output"; + BEAM_LOG_INFO() << "Run test with kernel without input and output"; TxGenerator gen(*m_pKdf); @@ -137,7 +137,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid = " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid = " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -146,7 +146,7 @@ void TestNodeConnection::GenerateTests() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_gethdr_test.cpp b/node/functionaltests/send_gethdr_test.cpp index 9ecddd722..8c9be505f 100644 --- a/node/functionaltests/send_gethdr_test.cpp +++ b/node/functionaltests/send_gethdr_test.cpp @@ -49,37 +49,37 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) msg.m_Description.get_ID(m_ID); m_IsInit = true; - LOG_INFO() << "NewTip: " << m_ID; + BEAM_LOG_INFO() << "NewTip: " << m_ID; - LOG_INFO() << "Send GetHdr message"; + BEAM_LOG_INFO() << "Send GetHdr message"; Send(proto::GetHdr{ m_ID }); } } void TestNodeConnection::OnMsg(proto::Hdr&& msg) { - LOG_INFO() << "Ok: Header is received: height = " << msg.m_Description.m_Height; + BEAM_LOG_INFO() << "Ok: Header is received: height = " << msg.m_Description.m_Height; - LOG_INFO() << "Send GetBody message"; + BEAM_LOG_INFO() << "Send GetBody message"; Send(proto::GetBody{ m_ID }); } void TestNodeConnection::OnMsg(proto::Body&& ) { - LOG_INFO() << "Ok: Body is received"; + BEAM_LOG_INFO() << "Ok: Body is received"; proto::GetHdr hdrMsg; hdrMsg.m_ID = m_ID; hdrMsg.m_ID.m_Height += 2; - LOG_INFO() << "Send GetHdr with wrong ID"; + BEAM_LOG_INFO() << "Send GetHdr with wrong ID"; Send(hdrMsg); } void TestNodeConnection::OnMsg(proto::DataMissing&& ) { - LOG_INFO() << "Ok: DataMissing is received"; + BEAM_LOG_INFO() << "Ok: DataMissing is received"; if (!m_IsSendWrongBody) { @@ -90,7 +90,7 @@ void TestNodeConnection::OnMsg(proto::DataMissing&& ) bodyMsg.m_ID = m_ID; bodyMsg.m_ID.m_Height += 2; - LOG_INFO() << "Send GetBody with wrong ID"; + BEAM_LOG_INFO() << "Send GetBody with wrong ID"; Send(bodyMsg); return; @@ -101,7 +101,7 @@ void TestNodeConnection::OnMsg(proto::DataMissing&& ) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_getmined_test.cpp b/node/functionaltests/send_getmined_test.cpp index 9f9d46a80..ba6ae197e 100644 --- a/node/functionaltests/send_getmined_test.cpp +++ b/node/functionaltests/send_getmined_test.cpp @@ -54,27 +54,27 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) msg.m_Description.get_ID(m_ID); m_IsInit = true; - LOG_INFO() << "NewTip: " << m_ID; + BEAM_LOG_INFO() << "NewTip: " << m_ID; m_IsSendWrongMsg = true; - LOG_INFO() << "Send wrong GetMined message"; + BEAM_LOG_INFO() << "Send wrong GetMined message"; Send(proto::GetMined{ m_ID.m_Height + 5 }); } } void TestNodeConnection::OnMsg(proto::Mined&& msg) { - LOG_INFO() << "Mined"; + BEAM_LOG_INFO() << "Mined"; if (m_IsSendWrongMsg) { if (msg.m_Entries.empty()) { - LOG_INFO() << "Ok: received empty list"; + BEAM_LOG_INFO() << "Ok: received empty list"; } else { - LOG_INFO() << "Failed: list is not empty"; + BEAM_LOG_INFO() << "Failed: list is not empty"; m_Failed = true; io::Reactor::get_Current().stop(); return; @@ -82,7 +82,7 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) m_IsSendWrongMsg = false; - LOG_INFO() << "Send GetMined message"; + BEAM_LOG_INFO() << "Send GetMined message"; proto::GetMined msgOut; msgOut.m_HeightMin = m_ID.m_Height - 1000; Send(msgOut); @@ -92,11 +92,11 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) if (!msg.m_Entries.empty()) { - LOG_INFO() << "Ok: list is not empty"; + BEAM_LOG_INFO() << "Ok: list is not empty"; } else { - LOG_INFO() << "Failed: list is empty"; + BEAM_LOG_INFO() << "Failed: list is empty"; m_Failed = true; } @@ -105,7 +105,7 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_getproofutxo_test.cpp b/node/functionaltests/send_getproofutxo_test.cpp index e4b5e5d90..e3c0564e3 100644 --- a/node/functionaltests/send_getproofutxo_test.cpp +++ b/node/functionaltests/send_getproofutxo_test.cpp @@ -35,7 +35,7 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) void TestNodeConnection::OnDisconnect(const DisconnectReason&) { - LOG_INFO() << "Ok: connection is reset"; + BEAM_LOG_INFO() << "Ok: connection is reset"; io::Reactor::get_Current().stop(); } @@ -43,7 +43,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Send GetProofUtxo message"; + BEAM_LOG_INFO() << "Send GetProofUtxo message"; Send(proto::GetProofUtxo()); }); } @@ -52,11 +52,11 @@ void TestNodeConnection::OnMsg(proto::ProofUtxo&& msg) { if (msg.m_Proofs.empty()) { - LOG_INFO() << "ProofUtxo: Ok - list is empty"; + BEAM_LOG_INFO() << "ProofUtxo: Ok - list is empty"; } else { - LOG_INFO() << "ProofUtxo: Failed - list is not empty"; + BEAM_LOG_INFO() << "ProofUtxo: Failed - list is not empty"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -64,7 +64,7 @@ void TestNodeConnection::OnMsg(proto::ProofUtxo&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_peer_info_test.cpp b/node/functionaltests/send_peer_info_test.cpp index 738eaf88a..69abdd07f 100644 --- a/node/functionaltests/send_peer_info_test.cpp +++ b/node/functionaltests/send_peer_info_test.cpp @@ -43,20 +43,20 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) void TestNodeConnection::OnDisconnect(const DisconnectReason&) { - LOG_INFO() << "Ok: connection is reset"; + BEAM_LOG_INFO() << "Ok: connection is reset"; io::Reactor::get_Current().stop(); } void TestNodeConnection::OnMsg(proto::NewTip&&) { - LOG_INFO() << "NewTip"; + BEAM_LOG_INFO() << "NewTip"; } void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Send PeerInfo message"; + BEAM_LOG_INFO() << "Send PeerInfo message"; Hash::Value hv; @@ -74,7 +74,7 @@ void TestNodeConnection::GenerateTests() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_to_node_10tx_test.cpp b/node/functionaltests/send_to_node_10tx_test.cpp index d317a5f96..eaff52267 100644 --- a/node/functionaltests/send_to_node_10tx_test.cpp +++ b/node/functionaltests/send_to_node_10tx_test.cpp @@ -49,7 +49,7 @@ void TestNodeConnection::GenerateTests() // Kernels gen.GenerateKernel(4); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -60,7 +60,7 @@ void TestNodeConnection::GenerateTests() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_tx_with_equal_commitment_test.cpp b/node/functionaltests/send_tx_with_equal_commitment_test.cpp index c28970c52..a9c8c6c42 100644 --- a/node/functionaltests/send_tx_with_equal_commitment_test.cpp +++ b/node/functionaltests/send_tx_with_equal_commitment_test.cpp @@ -61,7 +61,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -83,11 +83,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "OK: utxo is valid"; + BEAM_LOG_INFO() << "OK: utxo is valid"; } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -99,11 +99,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -115,7 +115,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_tx_with_unsorted_test.cpp b/node/functionaltests/send_tx_with_unsorted_test.cpp index c723dfe93..85e1a6815 100644 --- a/node/functionaltests/send_tx_with_unsorted_test.cpp +++ b/node/functionaltests/send_tx_with_unsorted_test.cpp @@ -40,7 +40,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Run test with unsorded kernels"; + BEAM_LOG_INFO() << "Run test with unsorded kernels"; TxGenerator gen = GenerateTx(); @@ -53,7 +53,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with unsorted inputs"; + BEAM_LOG_INFO() << "Run test with unsorted inputs"; TxGenerator gen = GenerateTx(); @@ -66,7 +66,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with unsorted outputs"; + BEAM_LOG_INFO() << "Run test with unsorted outputs"; TxGenerator gen = GenerateTx(); @@ -79,7 +79,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Run test with sorted inputs,outputs and kernels"; + BEAM_LOG_INFO() << "Run test with sorted inputs,outputs and kernels"; TxGenerator gen = GenerateTx(); gen.Sort(); @@ -114,7 +114,7 @@ TxGenerator TestNodeConnection::GenerateTx() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_tx_with_zero_output_test.cpp b/node/functionaltests/send_tx_with_zero_output_test.cpp index 3bf975169..4a8503ca9 100644 --- a/node/functionaltests/send_tx_with_zero_output_test.cpp +++ b/node/functionaltests/send_tx_with_zero_output_test.cpp @@ -61,7 +61,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -83,11 +83,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "OK: utxo is valid"; + BEAM_LOG_INFO() << "OK: utxo is valid"; } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -99,11 +99,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -115,7 +115,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_wrong_newtip_test.cpp b/node/functionaltests/send_wrong_newtip_test.cpp index 4f7b417bd..85b103aac 100644 --- a/node/functionaltests/send_wrong_newtip_test.cpp +++ b/node/functionaltests/send_wrong_newtip_test.cpp @@ -39,7 +39,7 @@ TestNodeConnection::TestNodeConnection(int argc, char* argv[]) bool TestNodeConnection::OnMsg2(proto::Status&& msg) { - LOG_INFO() << "Node returned: " << msg.m_Value; + BEAM_LOG_INFO() << "Node returned: " << msg.m_Value; return true; } @@ -48,11 +48,11 @@ bool TestNodeConnection::OnMsg2(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (m_Height == 0) { - LOG_INFO() << "Send NewTip with height = " << msg.m_Description.m_Height + 5; + BEAM_LOG_INFO() << "Send NewTip with height = " << msg.m_Description.m_Height + 5; proto::NewTip newMsg; newMsg.m_Description = msg.m_Description; @@ -71,11 +71,11 @@ bool TestNodeConnection::OnMsg2(proto::NewTip&& msg) { if (msg.m_Description.m_Height == m_Height) { - LOG_INFO() << "Ok"; + BEAM_LOG_INFO() << "Ok"; } else { - LOG_INFO() << "Failed"; + BEAM_LOG_INFO() << "Failed"; } io::Reactor::get_Current().stop(); } @@ -85,7 +85,7 @@ bool TestNodeConnection::OnMsg2(proto::NewTip&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/send_wrong_tx_test.cpp b/node/functionaltests/send_wrong_tx_test.cpp index ead0c8ffb..e6d32b743 100644 --- a/node/functionaltests/send_wrong_tx_test.cpp +++ b/node/functionaltests/send_wrong_tx_test.cpp @@ -40,7 +40,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = empty, output = 1, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = empty, output = 1, fee = 0"; TxGenerator gen(*m_pKdf); // Inputs are empty @@ -53,7 +53,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -61,7 +61,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 1, output = empty, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = 1, output = empty, fee = 0"; TxGenerator gen(*m_pKdf); @@ -75,7 +75,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -83,7 +83,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 1, output = 1, fee = 1"; + BEAM_LOG_INFO() << "Send tx with input = 1, output = 1, fee = 1"; TxGenerator gen(*m_pKdf); @@ -98,7 +98,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -106,7 +106,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with 2 inputs, 2 ouputs and 1 kernel"; + BEAM_LOG_INFO() << "Send tx with 2 inputs, 2 ouputs and 1 kernel"; TxGenerator gen(*m_pKdf); @@ -123,7 +123,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -131,7 +131,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with 2 inputs, 1 ouputs and 1 kernel"; + BEAM_LOG_INFO() << "Send tx with 2 inputs, 1 ouputs and 1 kernel"; TxGenerator gen(*m_pKdf); @@ -146,7 +146,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(6); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -154,7 +154,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with 1 inputs, 2 ouputs and 1 kernel"; + BEAM_LOG_INFO() << "Send tx with 1 inputs, 2 ouputs and 1 kernel"; TxGenerator gen(*m_pKdf); @@ -169,7 +169,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(7); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -177,7 +177,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 1, output = 2, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = 1, output = 2, fee = 0"; TxGenerator gen(*m_pKdf); @@ -191,7 +191,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(8); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -199,7 +199,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 2, output = 1, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = 2, output = 1, fee = 0"; TxGenerator gen(*m_pKdf); @@ -213,7 +213,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(9); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -221,7 +221,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 2, output = 3, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = 2, output = 3, fee = 0"; TxGenerator gen(*m_pKdf); @@ -235,7 +235,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(10); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -243,7 +243,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 4, output = 2, fee = 2"; + BEAM_LOG_INFO() << "Send tx with input = 4, output = 2, fee = 2"; TxGenerator gen(*m_pKdf); @@ -257,7 +257,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(11, 2); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -265,7 +265,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 4, output = 2, fee = 1, fee = 1"; + BEAM_LOG_INFO() << "Send tx with input = 4, output = 2, fee = 1, fee = 1"; TxGenerator gen(*m_pKdf); @@ -280,7 +280,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(12, 1); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -288,7 +288,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 4, output = 2, fee = 1, fee = 1, fee = 1"; + BEAM_LOG_INFO() << "Send tx with input = 4, output = 2, fee = 1, fee = 1, fee = 1"; TxGenerator gen(*m_pKdf); @@ -304,7 +304,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(13, 1); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -312,7 +312,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 4, output = 2, fee = 3"; + BEAM_LOG_INFO() << "Send tx with input = 4, output = 2, fee = 3"; TxGenerator gen(*m_pKdf); @@ -326,7 +326,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(14, 3); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -334,7 +334,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 2, without output, fee = 2"; + BEAM_LOG_INFO() << "Send tx with input = 2, without output, fee = 2"; TxGenerator gen(*m_pKdf); @@ -345,7 +345,7 @@ void TestNodeConnection::GenerateTests() gen.GenerateKernel(15, 2); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -353,7 +353,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 2, output = 1, fee = 1, offset of tx = 0"; + BEAM_LOG_INFO() << "Send tx with input = 2, output = 1, fee = 1, offset of tx = 0"; TxGenerator gen(*m_pKdf); @@ -369,7 +369,7 @@ void TestNodeConnection::GenerateTests() gen.ZeroOffset(); gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -377,11 +377,11 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx without input, output , fee "; + BEAM_LOG_INFO() << "Send tx without input, output , fee "; TxGenerator gen(*m_pKdf); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -389,7 +389,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input.m_Commitment = ouput.m_Commitment, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input.m_Commitment = ouput.m_Commitment, fee = 0"; TxGenerator gen(*m_pKdf); @@ -404,7 +404,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -412,7 +412,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 0, ouput = 0, fee = 0"; + BEAM_LOG_INFO() << "Send tx with input = 0, ouput = 0, fee = 0"; TxGenerator gen(*m_pKdf); @@ -427,7 +427,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -435,7 +435,7 @@ void TestNodeConnection::GenerateTests() m_Tests.push_back([this]() { - LOG_INFO() << "Send tx with input = 2, ouput = 0, fee = 2"; + BEAM_LOG_INFO() << "Send tx with input = 2, ouput = 0, fee = 2"; TxGenerator gen(*m_pKdf); @@ -450,7 +450,7 @@ void TestNodeConnection::GenerateTests() gen.Sort(); - LOG_INFO() << "tx.IsValid == " << gen.IsValid(); + BEAM_LOG_INFO() << "tx.IsValid == " << gen.IsValid(); Send(gen.GetTransaction()); }); @@ -459,7 +459,7 @@ void TestNodeConnection::GenerateTests() int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/spam_havetransactions_test.cpp b/node/functionaltests/spam_havetransactions_test.cpp index e638d92e3..611a217bd 100644 --- a/node/functionaltests/spam_havetransactions_test.cpp +++ b/node/functionaltests/spam_havetransactions_test.cpp @@ -73,7 +73,7 @@ void TestNodeConnection::GenerateTests() { m_Timer->start(10, true, [this] { - LOG_INFO() << "Send HaveTransaction: ind = " << m_Ind; + BEAM_LOG_INFO() << "Send HaveTransaction: ind = " << m_Ind; Transaction::KeyType id; SetRandom(id); @@ -91,7 +91,7 @@ void SendData(int argc, char* argv[], int h) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); //SendData(argc, argv, 1); std::vector> futures; diff --git a/node/functionaltests/spam_transactions_test.cpp b/node/functionaltests/spam_transactions_test.cpp index 17525ec17..73934a696 100644 --- a/node/functionaltests/spam_transactions_test.cpp +++ b/node/functionaltests/spam_transactions_test.cpp @@ -75,7 +75,7 @@ void TestNodeConnection::GenerateTests() { m_Tests.push_back([this, i]() { - LOG_INFO() << "Send big transaction"; + BEAM_LOG_INFO() << "Send big transaction"; BeforeConnection(100 * (m_H + 2) + i); Send(m_MsgTx); @@ -93,7 +93,7 @@ void SendData(int argc, char* argv[], int h) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); std::vector> futures; diff --git a/node/functionaltests/spam_valid_tx_test.cpp b/node/functionaltests/spam_valid_tx_test.cpp index f6f2d297d..dcad2eaf3 100644 --- a/node/functionaltests/spam_valid_tx_test.cpp +++ b/node/functionaltests/spam_valid_tx_test.cpp @@ -80,7 +80,7 @@ void TestNodeConnection::GenerateTests() void TestNodeConnection::OnMsg(proto::NewTip&& msg) { msg.m_Description.get_ID(m_ID); - LOG_INFO() << "NewTip: " << m_ID; + BEAM_LOG_INFO() << "NewTip: " << m_ID; if (!m_IsInit) { @@ -109,7 +109,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { TxGenerator gen(*m_pKdf); - LOG_INFO() << "Send coin #" << coin.m_Ind << "; input = " << coin.m_Input.m_Commitment << "; h = " << coin.m_Height << "; m_ID.m_Height = " << m_ID.m_Height; + BEAM_LOG_INFO() << "Send coin #" << coin.m_Ind << "; input = " << coin.m_Input.m_Commitment << "; h = " << coin.m_Height << "; m_ID.m_Height = " << m_ID.m_Height; gen.GenerateInputInTx(coin.m_Height, 1, Key::Type::Regular, coin.m_Ind); gen.GenerateOutputInTx(m_ID.m_Height, 1, Key::Type::Regular, false, coin.m_Ind); @@ -124,7 +124,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) coin.m_IsValid = false; coin.m_IsProcessChecking = false; - LOG_INFO() << "Send coin #" << coin.m_Ind << "; output = " << input.m_Commitment; + BEAM_LOG_INFO() << "Send coin #" << coin.m_Ind << "; output = " << input.m_Commitment; Send(gen.GetTransaction()); return; @@ -138,7 +138,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if(!coin.m_IsValid && !coin.m_IsProcessChecking) { - LOG_INFO() << "Add to check commitment = " << coin.m_Input.m_Commitment; + BEAM_LOG_INFO() << "Add to check commitment = " << coin.m_Input.m_Commitment; coin.m_IsProcessChecking = true; m_CoinsChecker.Check(CoinsChecker::Inputs{ coin.m_Input }, @@ -146,7 +146,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Coin is valid: #" << coin.m_Ind << "; input = " << coin.m_Input.m_Commitment << "; maturity = " << maturity; + BEAM_LOG_INFO() << "Coin is valid: #" << coin.m_Ind << "; input = " << coin.m_Input.m_Commitment << "; maturity = " << maturity; coin.m_IsValid = true; coin.m_IsProcessChecking = false; coin.m_Maturity = maturity; @@ -163,8 +163,8 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; - int fileLogLevel = LOG_LEVEL_INFO; + int logLevel = BEAM_LOG_LEVEL_DEBUG; + int fileLogLevel = BEAM_LOG_LEVEL_INFO; auto logger = beam::Logger::create(logLevel, logLevel, fileLogLevel, "test_"); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/spend_fee_test.cpp b/node/functionaltests/spend_fee_test.cpp index aeb477be0..5fbc5dd80 100644 --- a/node/functionaltests/spend_fee_test.cpp +++ b/node/functionaltests/spend_fee_test.cpp @@ -70,7 +70,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -104,11 +104,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "OK: utxo for fee is valid"; + BEAM_LOG_INFO() << "OK: utxo for fee is valid"; } else { - LOG_INFO() << "Failed: utxo for fee is not valid"; + BEAM_LOG_INFO() << "Failed: utxo for fee is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -120,11 +120,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -134,7 +134,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) void TestNodeConnection::OnMsg(proto::Mined&& msg) { - LOG_INFO() << "Mined"; + BEAM_LOG_INFO() << "Mined"; bool isHaveFee = false; for (const auto& mined : msg.m_Entries) @@ -158,7 +158,7 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) } else { - LOG_INFO() << "Failed: fee is invalid"; + BEAM_LOG_INFO() << "Failed: fee is invalid"; io::Reactor::get_Current().stop(); } } @@ -169,14 +169,14 @@ void TestNodeConnection::OnMsg(proto::Mined&& msg) if (!isHaveFee) { - LOG_INFO() << "Failed: fee is absent"; + BEAM_LOG_INFO() << "Failed: fee is absent"; io::Reactor::get_Current().stop(); } } int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/spend_mined_coins_test.cpp b/node/functionaltests/spend_mined_coins_test.cpp index 784f10f53..f2d719471 100644 --- a/node/functionaltests/spend_mined_coins_test.cpp +++ b/node/functionaltests/spend_mined_coins_test.cpp @@ -62,7 +62,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -83,7 +83,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; io::Reactor::get_Current().stop(); } @@ -100,11 +100,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "OK: utxo is valid"; + BEAM_LOG_INFO() << "OK: utxo is valid"; } else { - LOG_INFO() << "Failed: utxo is not valid"; + BEAM_LOG_INFO() << "Failed: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -116,11 +116,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -132,7 +132,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/tools/base_node_connection.cpp b/node/functionaltests/tools/base_node_connection.cpp index 59f312817..ec533efe6 100644 --- a/node/functionaltests/tools/base_node_connection.cpp +++ b/node/functionaltests/tools/base_node_connection.cpp @@ -85,19 +85,19 @@ void BaseTestNode::Run() void BaseTestNode::OnConnectedSecure() { - LOG_INFO() << "connection is succeded"; + BEAM_LOG_INFO() << "connection is succeded"; } void BaseTestNode::OnDisconnect(const DisconnectReason& reason) { - LOG_ERROR() << "problem with connecting to node: code = " << reason; + BEAM_LOG_ERROR() << "problem with connecting to node: code = " << reason; m_Failed = true; io::Reactor::get_Current().stop(); } void BaseTestNode::OnMsg(proto::Authentication&& msg) { - LOG_INFO() << "proto::Authentication"; + BEAM_LOG_INFO() << "proto::Authentication"; proto::NodeConnection::OnMsg(std::move(msg)); if (proto::IDType::Node == msg.m_IDType) @@ -107,7 +107,7 @@ void BaseTestNode::OnMsg(proto::Authentication&& msg) { m_Timer->start(m_Timeout, false, [this]() { - LOG_INFO() << "Timeout"; + BEAM_LOG_INFO() << "Timeout"; io::Reactor::get_Current().stop(); m_Failed = true; }); diff --git a/node/functionaltests/tools/coins_checker.cpp b/node/functionaltests/tools/coins_checker.cpp index 7b415994c..996c78873 100644 --- a/node/functionaltests/tools/coins_checker.cpp +++ b/node/functionaltests/tools/coins_checker.cpp @@ -63,7 +63,7 @@ void CoinsChecker::OnMsg(proto::Authentication&& msg) void CoinsChecker::OnDisconnect(const DisconnectReason& reason) { - LOG_ERROR() << "problem with connecting to node: code = " << reason; + BEAM_LOG_ERROR() << "problem with connecting to node: code = " << reason; for (const auto& tmp : m_Queue) { tmp.second(false, m_Maturity); @@ -86,7 +86,7 @@ void CoinsChecker::OnMsg(proto::ProofUtxo&& msg) { if (m_Current == m_Queue.front().first.end()) { - LOG_INFO() << "reaceived ProofUtxo twice"; + BEAM_LOG_INFO() << "reaceived ProofUtxo twice"; } if (msg.m_Proofs.empty()) diff --git a/node/functionaltests/tools/new_tx_tests.cpp b/node/functionaltests/tools/new_tx_tests.cpp index 13a6ee692..e65885091 100644 --- a/node/functionaltests/tools/new_tx_tests.cpp +++ b/node/functionaltests/tools/new_tx_tests.cpp @@ -28,12 +28,12 @@ void NewTxConnection::OnMsg(proto::Status&& msg) bool bOk = (proto::TxStatus::Ok == msg.m_Value); if (bOk != m_Results[m_Index]) { - LOG_INFO() << "Failed: node returned " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Failed: node returned " << static_cast(msg.m_Value); m_Failed = true; } else { - LOG_INFO() << "Ok: node returned " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Ok: node returned " << static_cast(msg.m_Value); } ++m_Index; diff --git a/node/functionaltests/try_spend_unknown_and_known_coins_test.cpp b/node/functionaltests/try_spend_unknown_and_known_coins_test.cpp index 7d71ec9d2..bb98e6681 100644 --- a/node/functionaltests/try_spend_unknown_and_known_coins_test.cpp +++ b/node/functionaltests/try_spend_unknown_and_known_coins_test.cpp @@ -61,7 +61,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -85,11 +85,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Failed: utxo is valid"; + BEAM_LOG_INFO() << "Failed: utxo is valid"; } else { - LOG_INFO() << "Ok: utxo is not valid"; + BEAM_LOG_INFO() << "Ok: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -101,11 +101,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -117,7 +117,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/functionaltests/try_spend_unknown_coins_test.cpp b/node/functionaltests/try_spend_unknown_coins_test.cpp index 767861e4f..d245d3f72 100644 --- a/node/functionaltests/try_spend_unknown_coins_test.cpp +++ b/node/functionaltests/try_spend_unknown_coins_test.cpp @@ -61,7 +61,7 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) Block::SystemState::ID id; msg.m_Description.get_ID(id); - LOG_INFO() << "NewTip: " << id; + BEAM_LOG_INFO() << "NewTip: " << id; if (!m_IsInit) { @@ -83,11 +83,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) { if (isOk) { - LOG_INFO() << "Failed: utxo is valid"; + BEAM_LOG_INFO() << "Failed: utxo is valid"; } else { - LOG_INFO() << "Ok: utxo is not valid"; + BEAM_LOG_INFO() << "Ok: utxo is not valid"; m_Failed = true; } io::Reactor::get_Current().stop(); @@ -99,11 +99,11 @@ void TestNodeConnection::OnMsg(proto::NewTip&& msg) void TestNodeConnection::OnMsg(proto::Status&& msg) { - LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); + BEAM_LOG_INFO() << "Status: value = " << static_cast(msg.m_Value); if (proto::TxStatus::Ok != msg.m_Value) { - LOG_INFO() << "Failed: tx is invalid"; + BEAM_LOG_INFO() << "Failed: tx is invalid"; m_Failed = true; io::Reactor::get_Current().stop(); @@ -115,7 +115,7 @@ void TestNodeConnection::OnMsg(proto::Status&& msg) int main(int argc, char* argv[]) { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = Logger::create(logLevel, logLevel); TestNodeConnection connection(argc, argv); diff --git a/node/node.cpp b/node/node.cpp index fd8f6bdf7..3cbf7c06c 100644 --- a/node/node.cpp +++ b/node/node.cpp @@ -76,7 +76,7 @@ void Node::UpdateSyncStatus() { m_PostStartSynced = true; - LOG_INFO() << "Tx replication is ON"; + BEAM_LOG_INFO() << "Tx replication is ON"; for (PeerList::iterator it = m_lstPeers.begin(); m_lstPeers.end() != it; ++it) { @@ -489,7 +489,7 @@ void Node::Processor::RequestData(const Block::SystemState::ID& id, bool bBlock, TaskSet::iterator it = get_ParentObj().m_setTasks.find(tKey); if (get_ParentObj().m_setTasks.end() == it) { - LOG_INFO() << "Requesting " << (bBlock ? "block" : "header") << " " << id; + BEAM_LOG_INFO() << "Requesting " << (bBlock ? "block" : "header") << " " << id; Node::Task* pTask = new Node::Task; pTask->m_Key = tKey.m_Key; @@ -635,7 +635,7 @@ void Node::Processor::OnNewState() if (!IsTreasuryHandled()) return; - LOG_INFO() << "My Tip: " << m_Cursor.m_ID << ", Work = " << Difficulty::ToFloat(m_Cursor.m_Full.m_ChainWork); + BEAM_LOG_INFO() << "My Tip: " << m_Cursor.m_ID << ", Work = " << Difficulty::ToFloat(m_Cursor.m_Full.m_ChainWork); if (IsFastSync()) return; @@ -712,7 +712,7 @@ void Node::MaybeGenerateRecovery() if (h1 < h0 + m_Cfg.m_Recovery.m_Granularity) return; - LOG_INFO() << "Generating recovery..."; + BEAM_LOG_INFO() << "Generating recovery..."; std::ostringstream os; os @@ -739,18 +739,18 @@ void Node::MaybeGenerateRecovery() } if (bOk) { - LOG_INFO() << "Recovery generation done"; + BEAM_LOG_INFO() << "Recovery generation done"; m_Processor.get_DB().ParamIntSet(NodeDB::ParamID::LastRecoveryHeight, h1); } else { - LOG_INFO() << "Recovery generation failed"; + BEAM_LOG_INFO() << "Recovery generation failed"; beam::DeleteFile(sTmp.c_str()); } } void Node::Processor::OnRolledBack() { - LOG_INFO() << "Rolled back to: " << m_Cursor.m_ID; + BEAM_LOG_INFO() << "Rolled back to: " << m_Cursor.m_ID; TxPool::Fluff& txp = get_ParentObj().m_TxPool; while (!txp.m_lstOutdated.empty()) @@ -877,7 +877,7 @@ void Node::Processor::OnEvent(Height h, const proto::Event::Base& evt) os << "Event Height=" << h << ", "; evt.Dump(os); - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } } @@ -975,7 +975,7 @@ Node::Peer* Node::AllocPeer(const beam::io::Address& addr) pPeer->m_CursorBbs = std::numeric_limits::max(); pPeer->m_pCursorTx = nullptr; - LOG_VERBOSE() << "+Peer " << addr; + BEAM_LOG_VERBOSE() << "+Peer " << addr; return pPeer; } @@ -1012,7 +1012,7 @@ void Node::Initialize(IExternalPOW* externalPOW) if (m_Cfg.m_ProcessorParams.m_EraseSelfID) { m_Processor.get_DB().ParamSet(NodeDB::ParamID::MyID, nullptr, nullptr); - LOG_INFO() << "Node ID erased"; + BEAM_LOG_INFO() << "Node ID erased"; io::Reactor::get_Current().stop(); return; @@ -1021,9 +1021,9 @@ void Node::Initialize(IExternalPOW* externalPOW) InitKeys(); InitIDs(); - LOG_INFO() << "Node ID=" << m_MyPublicID; - LOG_INFO() << "Initial Tip: " << m_Processor.m_Cursor.m_ID; - LOG_INFO() << "Tx replication is OFF"; + BEAM_LOG_INFO() << "Node ID=" << m_MyPublicID; + BEAM_LOG_INFO() << "Initial Tip: " << m_Processor.m_Cursor.m_ID; + BEAM_LOG_INFO() << "Tx replication is OFF"; if (!m_Cfg.m_Treasury.empty() && !m_Processor.IsTreasuryHandled()) { // stupid compiler insists on parentheses here! @@ -1310,7 +1310,7 @@ void Node::RefreshAccounts() if (nDel) { assert(nDel <= accs.size()); - LOG_INFO() << "Owned accounts removed: " << nDel; + BEAM_LOG_INFO() << "Owned accounts removed: " << nDel; size_t iDst = 0; for (size_t iSrc = 0; iSrc < accs.size(); iSrc++) @@ -1333,7 +1333,7 @@ void Node::RefreshAccounts() if (nAdd) { assert(nAdd <= accs.size()); - LOG_INFO() << "Owned accounts added: " << nAdd; + BEAM_LOG_INFO() << "Owned accounts added: " << nAdd; try { @@ -1352,7 +1352,7 @@ void Node::RefreshAccounts() for (const auto& acc : accs) os << '\t' << acc.get_Endpoint() << std::endl; - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } bool Node::Bbs::IsInLimits() const @@ -1397,7 +1397,7 @@ void Node::Bbs::MaybeCleanup() Node::~Node() { - LOG_INFO() << "Node stopping..."; + BEAM_LOG_INFO() << "Node stopping..."; m_Miner.HardAbortSafe(); if (m_Miner.m_External.m_pSolver) @@ -1430,7 +1430,7 @@ Node::~Node() if (!std::uncaught_exceptions() && m_Processor.get_DB().IsOpen()) m_PeerMan.OnFlush(); - LOG_INFO() << "Node stopped"; + BEAM_LOG_INFO() << "Node stopped"; } void Node::Peer::OnRequestTimeout() @@ -1438,7 +1438,7 @@ void Node::Peer::OnRequestTimeout() assert(Flags::Connected & m_Flags); assert(!m_lstTasks.empty()); - LOG_WARNING() << "Peer " << m_RemoteAddr << " request timeout"; + BEAM_LOG_WARNING() << "Peer " << m_RemoteAddr << " request timeout"; if (m_pInfo) ModifyRatingWrtData(0); // task (request) wasn't handled in time. @@ -1489,7 +1489,7 @@ void Node::Peer::OnTrafic(uint8_t msgCode, uint32_t msgSize, bool bOut) void Node::Peer::OnConnectedSecure() { - LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Connected"; + BEAM_LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Connected"; m_Flags |= Flags::Connected; @@ -1535,7 +1535,7 @@ Height Node::Peer::get_MinPeerFork() void Node::Peer::OnMsg(proto::Authentication&& msg) { proto::NodeConnection::OnMsg(std::move(msg)); - LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Auth. Type=" << msg.m_IDType << ", ID=" << msg.m_ID; + BEAM_LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Auth. Type=" << msg.m_IDType << ", ID=" << msg.m_ID; if (proto::IDType::Owner == msg.m_IDType) { @@ -1578,7 +1578,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) ThrowUnexpected(); m_Flags |= Flags::PiRcvd; - LOG_VERBOSE() << m_RemoteAddr << " received PI"; + BEAM_LOG_VERBOSE() << m_RemoteAddr << " received PI"; PeerMan& pm = m_This.m_PeerMan; // alias PeerManager::TimePoint tp; @@ -1603,12 +1603,12 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) if (pip.m_ID.m_Key == Zero) { - LOG_INFO() << "deleted anonymous PI"; + BEAM_LOG_INFO() << "deleted anonymous PI"; pm.Delete(pip); // it's anonymous. } else { - LOG_INFO() << "PeerID is different"; + BEAM_LOG_INFO() << "PeerID is different"; pm.OnActive(pip, false); pm.RemoveAddr(pip); // turned-out to be wrong } @@ -1616,7 +1616,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) if (msg.m_ID == m_This.m_MyPublicID) { - LOG_WARNING() << "Loopback connection"; + BEAM_LOG_WARNING() << "Loopback connection"; DeleteSelf(false, ByeReason::Loopback); return; } @@ -1629,7 +1629,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) addr = m_RemoteAddr; addr.port(m_Port); } else - LOG_INFO() << "No PI port"; // doesn't accept incoming connections? + BEAM_LOG_INFO() << "No PI port"; // doesn't accept incoming connections? PeerMan::PeerInfoPlus* pPi = Cast::Up(pm.OnPeer(msg.m_ID, addr, bAddrValid)); @@ -1640,14 +1640,14 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) if (Flags::Probe & m_Flags) { - LOG_INFO() << *pPi << " probed ok"; + BEAM_LOG_INFO() << *pPi << " probed ok"; DeleteSelf(false, ByeReason::Probed); return; } if (pPi->m_Live.m_p) { - LOG_INFO() << "Duplicate connection with the same PI."; + BEAM_LOG_INFO() << "Duplicate connection with the same PI."; // Duplicate connection. In this case we have to choose wether to terminate this connection, or the previous. The best is to do it asymmetrically. // We decide this based on our Node IDs. // In addition, if the older connection isn't completed yet (i.e. it's our connect attempt) - it's prefered for deletion, because such a connection may be impossible (firewalls and friends). @@ -1668,7 +1668,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) if (!pPi->m_RawRating.m_Value) { - LOG_INFO() << "Banned PI. Ignoring"; + BEAM_LOG_INFO() << "Banned PI. Ignoring"; DeleteSelf(false, ByeReason::Ban); return; } @@ -1677,7 +1677,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) pPi->Attach(*this); pm.OnActive(*pPi, true); - LOG_VERBOSE() << *m_pInfo << " connected, info updated"; + BEAM_LOG_VERBOSE() << *m_pInfo << " connected, info updated"; if ((Flags::Accepted & m_Flags) && !pPi->m_Addr.m_Value.empty()) { @@ -1687,7 +1687,7 @@ void Node::Peer::OnMsg(proto::Authentication&& msg) { pPi->m_LastConnectAttempt = ts; - LOG_VERBOSE() << *m_pInfo << " probing connection in opposite direction"; + BEAM_LOG_VERBOSE() << *m_pInfo << " probing connection in opposite direction"; Peer* p = m_This.AllocPeer(pPi->m_Addr.m_Value); @@ -1720,13 +1720,13 @@ bool Node::Peer::ShouldFinalizeMining() void Node::Peer::OnMsg(proto::Bye&& msg) { - LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Received Bye." << msg.m_Reason; + BEAM_LOG_VERBOSE() << "Peer " << m_RemoteAddr << " Received Bye." << msg.m_Reason; NodeConnection::OnMsg(std::move(msg)); } void Node::Peer::OnDisconnect(const DisconnectReason& dr) { - int nLogLevel = LOG_LEVEL_VERBOSE; + int nLogLevel = BEAM_LOG_LEVEL_VERBOSE; bool bIsErr = true; uint8_t nByeReason = 0; @@ -1755,19 +1755,19 @@ void Node::Peer::OnDisconnect(const DisconnectReason& dr) break; default: - nLogLevel = LOG_LEVEL_WARNING; + nLogLevel = BEAM_LOG_LEVEL_WARNING; } nByeReason = ByeReason::Ban; break; case DisconnectReason::Protocol: - nLogLevel = LOG_LEVEL_WARNING; + nLogLevel = BEAM_LOG_LEVEL_WARNING; nByeReason = ByeReason::Ban; break; } - LOG_MESSAGE(nLogLevel) << m_RemoteAddr << ": " << dr; + BEAM_LOG_MESSAGE(nLogLevel) << m_RemoteAddr << ": " << dr; DeleteSelf(bIsErr, nByeReason); } @@ -1803,7 +1803,7 @@ void Node::Peer::ReleaseTask(Task& t) void Node::Peer::DeleteSelf(bool bIsError, uint8_t nByeReason) { - LOG_VERBOSE() << "-Peer " << m_RemoteAddr; + BEAM_LOG_VERBOSE() << "-Peer " << m_RemoteAddr; if (nByeReason && (Flags::Connected & m_Flags)) { @@ -1863,7 +1863,7 @@ void Node::Peer::DeleteSelf(bool bIsError, uint8_t nByeReason) if (bDelete) { - LOG_VERBOSE() << pip << " Deleted"; + BEAM_LOG_VERBOSE() << pip << " Deleted"; pm.Delete(pip); } } @@ -1927,7 +1927,7 @@ void Node::Peer::OnMsg(proto::NewTip&& msg) Processor& p = m_This.m_Processor; bool bTipNeeded = NodeProcessor::IsRemoteTipNeeded(m_Tip, p.m_Cursor.m_Full); - LOG_MESSAGE(bTipNeeded ? LOG_LEVEL_INFO: LOG_LEVEL_VERBOSE) << "Peer " << m_RemoteAddr << " Tip: " << id; + BEAM_LOG_MESSAGE(bTipNeeded ? BEAM_LOG_LEVEL_INFO: BEAM_LOG_LEVEL_VERBOSE) << "Peer " << m_RemoteAddr << " Tip: " << id; if (!m_pInfo) return; @@ -2144,7 +2144,7 @@ void Node::Peer::OnMsg(proto::HdrPack&& msg) } } - LOG_INFO() << "Hdr pack received " << msg.m_Prefix.m_Height << "-" << idLast; + BEAM_LOG_INFO() << "Hdr pack received " << msg.m_Prefix.m_Height << "-" << idLast; ModifyRatingWrtData(sizeof(msg.m_Prefix) + msg.m_vElements.size() * sizeof(msg.m_vElements.front())); @@ -2355,7 +2355,7 @@ void Node::Peer::OnMsg(proto::BodyPack&& msg) const uint64_t* pPtr = p.get_CachedRows(t.m_sidTrg, hCountExtra); if (pPtr) { - LOG_INFO() << id << " Block pack received " << id.m_Height << "-" << (id.m_Height + msg.m_Bodies.size() - 1); + BEAM_LOG_INFO() << id << " Block pack received " << id.m_Height << "-" << (id.m_Height + msg.m_Bodies.size() - 1); eStatus = NodeProcessor::DataStatus::Accepted; @@ -2437,7 +2437,7 @@ void Node::OnTransactionDeferred(Transaction::Ptr&& pTx, std::unique_ptrget_Key(key); - // LOG_INFO() << "Tx " << key << " deferred"; + // BEAM_LOG_INFO() << "Tx " << key << " deferred"; //} if (m_TxDeferred.m_lst.empty()) @@ -2616,7 +2616,7 @@ void Node::LogTx(const Transaction& tx, uint8_t nStatus, const Transaction::KeyT } os << "\n\tStatus: " << static_cast(nStatus); - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } void Node::LogTxStem(const Transaction& tx, const char* szTxt) @@ -2635,7 +2635,7 @@ void Node::LogTxStem(const Transaction& tx, const char* szTxt) os << "\n\tK: " << sz; } - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } const ECC::uintBig& Node::NextNonce() @@ -2807,7 +2807,7 @@ void Node::OnTransactionAggregated(Transaction::Ptr&& pTx, const TxPool::Stats& { if (m_Cfg.m_LogTxStem) { - LOG_INFO() << "Stem continues to " << pNext->m_RemoteAddr; + BEAM_LOG_INFO() << "Stem continues to " << pNext->m_RemoteAddr; } pNext->SendTx(pTx, false); @@ -4084,7 +4084,7 @@ void Node::Peer::OnMsg(proto::GetEvents&& msg) ser.swap_buf(msgOut.m_Events); } else - LOG_WARNING() << "Peer " << m_RemoteAddr << " Unauthorized Utxo events request."; + BEAM_LOG_WARNING() << "Peer " << m_RemoteAddr << " Unauthorized Utxo events request."; Send(msgOut); } @@ -4163,13 +4163,13 @@ void Node::Peer::OnMsg(proto::BlockFinalization&& msg) if (!bRes) { - LOG_WARNING() << "Block finalization failed"; + BEAM_LOG_WARNING() << "Block finalization failed"; return; } Cast::Down(x) = std::move(bc); - LOG_INFO() << "Block Finalized by owner"; + BEAM_LOG_INFO() << "Block Finalized by owner"; m_This.m_Miner.StartMining(std::move(pTask)); } @@ -4696,7 +4696,7 @@ bool Node::Miner::Restart() if (!bRes) { - LOG_WARNING() << "Block generation failed, can't mine!"; + BEAM_LOG_WARNING() << "Block generation failed, can't mine!"; return false; } @@ -4709,7 +4709,7 @@ bool Node::Miner::Restart() if (m_pFinalizer) { const NodeProcessor::GeneratedBlock& x = *pTask; - LOG_INFO() << "Block generated: Height=" << x.m_Hdr.m_Height << ", Fee=" << x.m_Fees << ", Waiting for owner response..."; + BEAM_LOG_INFO() << "Block generated: Height=" << x.m_Hdr.m_Height << ", Fee=" << x.m_Fees << ", Waiting for owner response..."; proto::GetBlockFinalization msg; msg.m_Height = pTask->m_Hdr.m_Height; @@ -4732,7 +4732,7 @@ bool Node::Miner::IsShouldMine(const NodeProcessor::GeneratedBlock& bc) if (bc.m_Fees >= m_FeesTrg) return true; - LOG_INFO() << "Block generation no change"; + BEAM_LOG_INFO() << "Block generation no change"; return false; } @@ -4744,7 +4744,7 @@ void Node::Miner::StartMining(Task::Ptr&& pTask) if (!IsShouldMine(x)) return; - LOG_INFO() << "Block generated: Height=" << x.m_Hdr.m_Height << ", Fee=" << x.m_Fees << ", Difficulty=" << x.m_Hdr.m_PoW.m_Difficulty << ", Size=" << (x.m_BodyP.size() + x.m_BodyE.size()); + BEAM_LOG_INFO() << "Block generated: Height=" << x.m_Hdr.m_Height << ", Fee=" << x.m_Fees << ", Difficulty=" << x.m_Hdr.m_PoW.m_Difficulty << ", Size=" << (x.m_BodyP.size() + x.m_BodyE.size()); m_FeesTrg = x.m_Fees + 1; @@ -4786,7 +4786,7 @@ void Node::Miner::OnRefreshExternal() return; // NOTE the mutex is locked here - LOG_INFO() << "New job for external miner"; + BEAM_LOG_INFO() << "New job for external miner"; uint64_t jobID = ++m_External.m_jobID; m_External.get_At(jobID) = m_pTask; @@ -4815,11 +4815,11 @@ IExternalPOW::BlockFoundResult Node::Miner::OnMinedExternal() bool bReject = (m_External.m_jobID - jobID >= _countof(m_External.m_ppTask)); - LOG_INFO() << "Solution from external miner. jobID=" << jobID << ", Current.jobID=" << m_External.m_jobID << ", Accept=" << static_cast(!bReject); + BEAM_LOG_INFO() << "Solution from external miner. jobID=" << jobID << ", Current.jobID=" << m_External.m_jobID << ", Accept=" << static_cast(!bReject); if (bReject) { - LOG_INFO() << "Solution is rejected due it is outdated."; + BEAM_LOG_INFO() << "Solution is rejected due it is outdated."; return IExternalPOW::solution_expired; // outdated } @@ -4827,7 +4827,7 @@ IExternalPOW::BlockFoundResult Node::Miner::OnMinedExternal() if (!pTask || *pTask->m_pStop) { - LOG_INFO() << "Solution is rejected due block mining has been canceled."; + BEAM_LOG_INFO() << "Solution is rejected due block mining has been canceled."; return IExternalPOW::solution_rejected; // already cancelled } @@ -4836,7 +4836,7 @@ IExternalPOW::BlockFoundResult Node::Miner::OnMinedExternal() if (!pTask->m_Hdr.IsValidPoW()) { - LOG_INFO() << "invalid solution from external miner"; + BEAM_LOG_INFO() << "invalid solution from external miner"; return IExternalPOW::solution_rejected; } @@ -4865,7 +4865,7 @@ void Node::Miner::OnMined() Block::SystemState::ID id; pTask->m_Hdr.get_ID(id); - LOG_INFO() << "New block mined: " << id; + BEAM_LOG_INFO() << "New block mined: " << id; Processor& p = get_ParentObj().m_Processor; // alias NodeProcessor::DataStatus::Enum eStatus = p.OnState(pTask->m_Hdr, get_ParentObj().m_MyPublicID); @@ -4874,12 +4874,12 @@ void Node::Miner::OnMined() default: case NodeProcessor::DataStatus::Invalid: // Some bug? - LOG_WARNING() << "Mined block rejected as invalid!"; + BEAM_LOG_WARNING() << "Mined block rejected as invalid!"; return; case NodeProcessor::DataStatus::Rejected: // Someone else mined exactly the same block! - LOG_WARNING() << "Mined block duplicated"; + BEAM_LOG_WARNING() << "Mined block duplicated"; return; case NodeProcessor::DataStatus::Accepted: @@ -5342,7 +5342,7 @@ bool Node::GenerateRecoveryInfo(const char* szPath) } catch (const std::exception& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); return false; } @@ -5425,7 +5425,7 @@ void Node::PrintTxos() } } - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } } @@ -5561,7 +5561,7 @@ void Node::PrintRollbackStats() } - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } void Node::GenerateFakeBlocks(uint32_t n) diff --git a/node/node_client.cpp b/node/node_client.cpp index df58a74e4..88f355cba 100644 --- a/node/node_client.cpp +++ b/node/node_client.cpp @@ -72,7 +72,7 @@ namespace } catch (std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } } @@ -113,10 +113,10 @@ namespace beam } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -191,18 +191,18 @@ namespace beam } catch (const io::Exception& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); m_observer->onFailedToStartNode(ex.errorCode); bErr = false; recreate = true; } catch (const std::runtime_error& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); } catch (const CorruptionException& ex) { - LOG_ERROR() << "Corruption: " << ex.m_sErr; + BEAM_LOG_ERROR() << "Corruption: " << ex.m_sErr; } if (bErr) @@ -217,12 +217,12 @@ namespace beam } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } // commented intentionally to be able to catch crash //catch (...) //{ - // LOG_UNHANDLED_EXCEPTION(); + // BEAM_LOG_UNHANDLED_EXCEPTION(); //} m_observer->onNodeThreadFinished(); @@ -295,11 +295,11 @@ namespace beam } else { - LOG_ERROR() << "Unable to resolve node address: " << peer; + BEAM_LOG_ERROR() << "Unable to resolve node address: " << peer; } } - LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; + BEAM_LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; class MyObserver final : public Node::IObserver, public ILongAction { diff --git a/node/processor.cpp b/node/processor.cpp index 310d406f2..bc988ab7c 100644 --- a/node/processor.cpp +++ b/node/processor.cpp @@ -94,7 +94,7 @@ void NodeProcessor::Initialize(const char* szPath, const StartParams& sp, ILongA m_pExternalHandler = pExternalHandler; if (sp.m_CheckIntegrity) { - LOG_INFO() << "DB integrity check..."; + BEAM_LOG_INFO() << "DB integrity check..."; m_DB.CheckIntegrity(); } @@ -130,7 +130,7 @@ void NodeProcessor::Initialize(const char* szPath, const StartParams& sp, ILongA if (bUpdateChecksum) { - LOG_INFO() << "Settings configuration"; + BEAM_LOG_INFO() << "Settings configuration"; blob = Blob(Rules::get().get_LastFork().m_Hash); m_DB.ParamSet(NodeDB::ParamID::CfgChecksum, NULL, &blob); @@ -201,7 +201,7 @@ void NodeProcessor::Initialize(const char* szPath, const StartParams& sp, ILongA if (PruneOld() && !sp.m_Vacuum) { - LOG_INFO() << "Old data was just removed from the DB. Some space can be freed by vacuum"; + BEAM_LOG_INFO() << "Old data was just removed from the DB. Some space can be freed by vacuum"; } if (sp.m_Vacuum) @@ -265,9 +265,9 @@ void NodeProcessor::ManualSelection::Save() const void NodeProcessor::ManualSelection::Log() const { if (MaxHeight == m_Sid.m_Height) { - LOG_INFO() << "Manual selection state reset"; + BEAM_LOG_INFO() << "Manual selection state reset"; } else { - LOG_INFO() << (m_Forbidden ? "Forbidden" : "Selected") << " state: " << m_Sid; + BEAM_LOG_INFO() << (m_Forbidden ? "Forbidden" : "Selected") << " state: " << m_Sid; } } @@ -285,7 +285,7 @@ bool NodeProcessor::ManualSelection::IsAllowed(const Merkle::Hash& hv) const Block::SystemState::ID sid; sid.m_Height = m_Sid.m_Height; sid.m_Hash = hv; - LOG_WARNING() << sid << " State forbidden"; + BEAM_LOG_WARNING() << sid << " State forbidden"; return false; } @@ -293,11 +293,11 @@ void NodeProcessor::InitializeMapped(const char* sz) { if (InitMapping(sz, false)) { - LOG_INFO() << "Mapping image found"; + BEAM_LOG_INFO() << "Mapping image found"; if (TestDefinition()) return; // ok - LOG_WARNING() << "Definition mismatch, discarding mapped image"; + BEAM_LOG_WARNING() << "Definition mismatch, discarding mapped image"; m_Mapped.Close(); InitMapping(sz, true); } @@ -313,7 +313,7 @@ void NodeProcessor::TestDefinitionStrict() { if (!TestDefinition()) { - LOG_ERROR() << "Definition mismatch"; + BEAM_LOG_ERROR() << "Definition mismatch"; OnCorrupted(); } } @@ -387,7 +387,7 @@ void NodeProcessor::LogSyncData() if (!IsFastSync()) return; - LOG_INFO() << "Fast-sync mode up to height " << m_SyncData.m_Target.m_Height; + BEAM_LOG_INFO() << "Fast-sync mode up to height " << m_SyncData.m_Target.m_Height; } @@ -421,7 +421,7 @@ NodeProcessor::~NodeProcessor() try { CommitMappingAndDB(); } catch (const CorruptionException& e) { - LOG_ERROR() << "DB Commit failed: %s" << e.m_sErr; + BEAM_LOG_ERROR() << "DB Commit failed: %s" << e.m_sErr; } } } @@ -456,9 +456,9 @@ void NodeProcessor::Vacuum() if (m_DbTx.IsInProgress()) m_DbTx.Commit(); - LOG_INFO() << "DB compacting..."; + BEAM_LOG_INFO() << "DB compacting..."; m_DB.Vacuum(); - LOG_INFO() << "DB compacting completed"; + BEAM_LOG_INFO() << "DB compacting completed"; m_DbTx.Start(m_DB); } @@ -887,7 +887,7 @@ void NodeProcessor::UnreachableLog::Log(const Block::SystemState::ID& id) } m_Time_ms = nTime_ms; - LOG_WARNING() << id << " State unreachable"; // probably will pollute the log, but it's a critical situation anyway + BEAM_LOG_WARNING() << id << " State unreachable"; // probably will pollute the log, but it's a critical situation anyway } struct NodeProcessor::MultiSigmaContext @@ -1574,11 +1574,11 @@ struct NodeProcessor::MultiblockContext if (m_This.m_SyncData.m_TxoLo > m_This.m_SyncData.m_h0) { - LOG_INFO() << "Retrying with lower TxLo"; + BEAM_LOG_INFO() << "Retrying with lower TxLo"; m_This.m_SyncData.m_TxoLo = m_This.m_SyncData.m_h0; } else { - LOG_WARNING() << "TxLo already low"; + BEAM_LOG_WARNING() << "TxLo already low"; } m_This.SaveSyncData(); @@ -1589,7 +1589,7 @@ struct NodeProcessor::MultiblockContext void OnFastSyncFailedOnLo() { // probably problem in lower blocks - LOG_WARNING() << "Fast-sync failed on first above-TxLo block."; + BEAM_LOG_WARNING() << "Fast-sync failed on first above-TxLo block."; m_pidLast = Zero; // don't blame the last peer OnFastSyncFailed(true); } @@ -1796,7 +1796,7 @@ void NodeProcessor::TryGoTo(NodeDB::StateID& sidTrg) return; // at position if (!bContextFail) - LOG_WARNING() << "Context-free verification failed: " << mbc.m_sErr; + BEAM_LOG_WARNING() << "Context-free verification failed: " << mbc.m_sErr; RollbackTo(mbc.m_InProgress.m_Min - 1); @@ -1822,7 +1822,7 @@ void NodeProcessor::TryGoTo(NodeDB::StateID& sidTrg) } } - LOG_INFO() << "Deleting blocks range: " << (m_Cursor.m_Sid.m_Height + 1) << "-" << sidFwd.m_Height; + BEAM_LOG_INFO() << "Deleting blocks range: " << (m_Cursor.m_Sid.m_Height + 1) << "-" << sidFwd.m_Height; DeleteBlocksInRange(sidFwd, m_Cursor.m_Sid.m_Height); } @@ -1855,7 +1855,7 @@ void NodeProcessor::OnFastSyncOver(MultiblockContext& mbc, bool& bContextFail) if (mbc.m_bFail) { - LOG_WARNING() << "Fast-sync failed: " << mbc.m_sErr; + BEAM_LOG_WARNING() << "Fast-sync failed: " << mbc.m_sErr; if (!m_DB.get_Peer(sidFail.m_Row, mbc.m_pidLast)) mbc.m_pidLast = Zero; @@ -1898,7 +1898,7 @@ void NodeProcessor::OnFastSyncOver(MultiblockContext& mbc, bool& bContextFail) } else { - LOG_INFO() << "Fast-sync succeeded"; + BEAM_LOG_INFO() << "Fast-sync succeeded"; // raise fossil height, hTxoLo, hTxoHi RaiseFossil(m_Cursor.m_ID.m_Height); @@ -2660,7 +2660,7 @@ bool NodeProcessor::ExtractTreasury(const Blob& blob, Treasury::Data& td) der & td; } catch (const std::exception&) { - LOG_WARNING() << "Treasury corrupt"; + BEAM_LOG_WARNING() << "Treasury corrupt"; return false; } @@ -2677,7 +2677,7 @@ bool NodeProcessor::HandleTreasury(const Blob& blob) if (!td.IsValid()) { - LOG_WARNING() << "Treasury validation failed"; + BEAM_LOG_WARNING() << "Treasury validation failed"; return false; } @@ -2693,7 +2693,7 @@ bool NodeProcessor::HandleTreasury(const Blob& blob) os << "\n\t" << "Height=" << b.m_Height << ", Value=" << b.m_Value; } - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); } BlockInterpretCtx bic(0, true); @@ -2711,7 +2711,7 @@ bool NodeProcessor::HandleTreasury(const Blob& blob) OnCorrupted(); // although should not happen anyway } - LOG_WARNING() << "Treasury invalid"; + BEAM_LOG_WARNING() << "Treasury invalid"; return false; } } @@ -2876,7 +2876,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS der & Cast::Down(block); } catch (const std::exception&) { - LOG_WARNING() << LogSid(m_DB, sid) << " Block deserialization failed"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Block deserialization failed"; return false; } @@ -2897,19 +2897,19 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS if (wrk != s.m_ChainWork) { - LOG_WARNING() << LogSid(m_DB, sid) << " Chainwork expected=" << wrk <<", actual=" << s.m_ChainWork; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Chainwork expected=" << wrk <<", actual=" << s.m_ChainWork; return false; } if (m_Cursor.m_DifficultyNext.m_Packed != s.m_PoW.m_Difficulty.m_Packed) { - LOG_WARNING() << LogSid(m_DB, sid) << " Difficulty expected=" << m_Cursor.m_DifficultyNext << ", actual=" << s.m_PoW.m_Difficulty; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Difficulty expected=" << m_Cursor.m_DifficultyNext << ", actual=" << s.m_PoW.m_Difficulty; return false; } if (s.m_TimeStamp <= get_MovingMedian()) { - LOG_WARNING() << LogSid(m_DB, sid) << " Timestamp inconsistent wrt median"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Timestamp inconsistent wrt median"; return false; } } @@ -2937,7 +2937,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS { assert(bFirstTime); assert(m_Extra.m_Txos == id0); - LOG_WARNING() << LogSid(m_DB, sid) << " invalid in its context: " << osErr.str(); + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " invalid in its context: " << osErr.str(); } else { @@ -2965,7 +2965,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS // check the validity of state description. if (s.m_Definition != hvDef) { - LOG_WARNING() << LogSid(m_DB, sid) << " Header Definition mismatch"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Header Definition mismatch"; bOk = false; } } @@ -2977,7 +2977,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS get_Utxos().get_Hash(hvDef); if (s.m_Kernels != hvDef) { - LOG_WARNING() << LogSid(m_DB, sid) << " Utxos mismatch"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Utxos mismatch"; bOk = false; } } @@ -2986,7 +2986,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS { if (s.m_Kernels != ev.m_hvKernels) { - LOG_WARNING() << LogSid(m_DB, sid) << " Kernel commitment mismatch"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Kernel commitment mismatch"; bOk = false; } } @@ -2998,7 +2998,7 @@ bool NodeProcessor::HandleBlock(const NodeDB::StateID& sid, const Block::SystemS { if (block.m_vInputs[i]->m_Internal.m_ID >= mbc.m_id0) { - LOG_WARNING() << LogSid(m_DB, sid) << " Invalid input in sparse block"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Invalid input in sparse block"; bOk = false; break; } @@ -3599,7 +3599,7 @@ void NodeProcessor::RescanAccounts(uint32_t nRecent) EnumTxos(wlk); - LOG_INFO() << "Recovered " << wlk.m_Unspent << "/" << wlk.m_Total << " unspent/total Txos"; + BEAM_LOG_INFO() << "Recovered " << wlk.m_Unspent << "/" << wlk.m_Total << " unspent/total Txos"; } // shielded items @@ -4988,7 +4988,7 @@ bool NodeProcessor::BlockInterpretCtx::BvmProcessor::Invoke(const bvm2::Contract } if (m_Instruction.m_ModeTriggered) { - LOG_WARNING() << " Potential wasm conflict"; + BEAM_LOG_WARNING() << " Potential wasm conflict"; } return bRes; @@ -5171,7 +5171,7 @@ void NodeProcessor::BlockInterpretCtx::BvmProcessor::ParseExtraInfo(ContractInvo } catch (const std::exception& e) { - LOG_WARNING() << "contract parser error: " << e.what(); + BEAM_LOG_WARNING() << "contract parser error: " << e.what(); } } @@ -5192,7 +5192,7 @@ void NodeProcessor::get_ContractDescr(const ECC::uintBig& sid, const ECC::uintBi } catch (const std::exception& e) { - LOG_WARNING() << "contract parser error: " << e.what(); + BEAM_LOG_WARNING() << "contract parser error: " << e.what(); } } @@ -5858,7 +5858,7 @@ void NodeProcessor::AdjustManualRollbackHeight(Height& h) Height hMin = get_LowestManualReturnHeight(); if (h < hMin) { - LOG_INFO() << "Can't go below Height " << hMin; + BEAM_LOG_INFO() << "Can't go below Height " << hMin; h = hMin; } } @@ -5869,7 +5869,7 @@ void NodeProcessor::ManualRollbackInternal(Height h) if (IsFastSync() && (m_SyncData.m_Target.m_Height > h)) { - LOG_INFO() << "Fast-sync abort..."; + BEAM_LOG_INFO() << "Fast-sync abort..."; RollbackTo(m_SyncData.m_h0); DeleteBlocksInRange(m_SyncData.m_Target, m_SyncData.m_h0); @@ -5892,7 +5892,7 @@ void NodeProcessor::ManualRollbackInternal(Height h) void NodeProcessor::ManualRollbackTo(Height h) { - LOG_INFO() << "Manual rollback to " << h << "..."; + BEAM_LOG_INFO() << "Manual rollback to " << h << "..."; AdjustManualRollbackHeight(h); @@ -5926,7 +5926,7 @@ void NodeProcessor::ManualSelect(const Block::SystemState::ID& sid) m_DB.get_StateHash(FindActiveAtStrict(sid.m_Height), hv); if (hv == sid.m_Hash) { - LOG_INFO() << "Already at correct branch"; + BEAM_LOG_INFO() << "Already at correct branch"; } else { @@ -5934,11 +5934,11 @@ void NodeProcessor::ManualSelect(const Block::SystemState::ID& sid) AdjustManualRollbackHeight(h); if (h == sid.m_Height - 1) { - LOG_INFO() << "Rolling back to " << h; + BEAM_LOG_INFO() << "Rolling back to " << h; ManualRollbackInternal(h); } else { - LOG_INFO() << "Unable to rollback below incorrect branch. Please resync from the beginning"; + BEAM_LOG_INFO() << "Unable to rollback below incorrect branch. Please resync from the beginning"; } } } @@ -5950,7 +5950,7 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnStateInternal(const Block::Syst if (!(bAlreadyChecked || s.IsValid())) { - LOG_WARNING() << id << " header invalid!"; + BEAM_LOG_WARNING() << id << " header invalid!"; return DataStatus::Invalid; } @@ -5960,7 +5960,7 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnStateInternal(const Block::Syst ts = s.m_TimeStamp - ts; // dt if (ts > Rules::get().DA.MaxAhead_s) { - LOG_WARNING() << id << " Timestamp ahead by " << ts; + BEAM_LOG_WARNING() << id << " Timestamp ahead by " << ts; return DataStatus::Invalid; } } @@ -5984,7 +5984,7 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnState(const Block::SystemState: DataStatus::Enum ret = OnStateSilent(s, peer, id, false); if (DataStatus::Accepted == ret) { - LOG_INFO() << id << " Header accepted"; + BEAM_LOG_INFO() << id << " Header accepted"; } return ret; @@ -6005,7 +6005,7 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnBlock(const Block::SystemState: sid.m_Row = m_DB.StateFindSafe(id); if (!sid.m_Row) { - LOG_WARNING() << id << " Block unexpected"; + BEAM_LOG_WARNING() << id << " Block unexpected"; return DataStatus::Rejected; } @@ -6018,13 +6018,13 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnBlock(const NodeDB::StateID& si size_t nSize = size_t(bbP.n) + size_t(bbE.n); if (nSize > Rules::get().MaxBodySize) { - LOG_WARNING() << LogSid(m_DB, sid) << " Block too large: " << nSize; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Block too large: " << nSize; return DataStatus::Invalid; } if (NodeDB::StateFlags::Functional & m_DB.GetStateFlags(sid.m_Row)) { - LOG_WARNING() << LogSid(m_DB, sid) << " Block already received"; + BEAM_LOG_WARNING() << LogSid(m_DB, sid) << " Block already received"; return DataStatus::Rejected; } @@ -6060,7 +6060,7 @@ NodeProcessor::DataStatus::Enum NodeProcessor::OnTreasury(const Blob& blob) m_Extra.m_TxosTreasury = m_Extra.m_Txos; m_DB.ParamSet(NodeDB::ParamID::Treasury, &m_Extra.m_TxosTreasury, &blob); - LOG_INFO() << "Treasury verified"; + BEAM_LOG_INFO() << "Treasury verified"; RescanAccounts(static_cast(m_vAccounts.size())); @@ -6254,7 +6254,7 @@ uint8_t NodeProcessor::ValidateTxContextEx(const Transaction& tx, const HeightRa DependentContextSwitch dcs(*this, bic); if (!dcs.Apply(pParent)) { - LOG_WARNING() << "can't switch dependent context"; // normally should not happen + BEAM_LOG_WARNING() << "can't switch dependent context"; // normally should not happen return proto::TxStatus::DependentNoParent; } @@ -6438,7 +6438,7 @@ size_t NodeProcessor::GenerateNewBlockInternal(BlockContext& bc, BlockInterpretC if (ssc.m_Counter.m_Value > nSizeMax) { // the block may be non-empty (i.e. contain treasury) - LOG_WARNING() << "Block too large."; + BEAM_LOG_WARNING() << "Block too large."; return 0; // } @@ -6509,7 +6509,7 @@ size_t NodeProcessor::GenerateNewBlockInternal(BlockContext& bc, BlockInterpretC (bc.m_Block.m_vKernels.size() == 1)) { // won't fit in empty block - LOG_INFO() << "Tx is too big."; + BEAM_LOG_INFO() << "Tx is too big."; bc.m_TxPool.Delete(x); } continue; @@ -6546,7 +6546,7 @@ size_t NodeProcessor::GenerateNewBlockInternal(BlockContext& bc, BlockInterpretC } } - LOG_INFO() << "GenerateNewBlock: size of block = " << ssc.m_Counter.m_Value << "; amount of tx = " << nTxNum; + BEAM_LOG_INFO() << "GenerateNewBlock: size of block = " << ssc.m_Counter.m_Value << "; amount of tx = " << nTxNum; if (BlockContext::Mode::Assemble != bc.m_Mode) { @@ -6674,7 +6674,7 @@ bool NodeProcessor::GenerateNewBlock(BlockContext& bc) bool bOk = HandleValidatedTx(bc.m_Block, bic); if (!bOk) { - LOG_WARNING() << "couldn't apply block after cut-through!"; + BEAM_LOG_WARNING() << "couldn't apply block after cut-through!"; ZeroObject(bc.m_Hdr); bc.m_Hdr.m_Height = bic.m_Height; OnInvalidBlock(bc.m_Hdr, bc.m_Block); diff --git a/node/unittests/node_1_test.cpp b/node/unittests/node_1_test.cpp index 73d1924f3..1e521db0c 100644 --- a/node/unittests/node_1_test.cpp +++ b/node/unittests/node_1_test.cpp @@ -152,7 +152,7 @@ namespace beam cl.SetTimer(timerInterval); pReactor->run(); - LOG_VERBOSE() << pReactor.use_count(); + BEAM_LOG_VERBOSE() << pReactor.use_count(); } void TestP2pSane() @@ -177,7 +177,7 @@ namespace beam for (int i = 0; i < 15; i++) { msg.m_ID.m_Height = m_Out++; - LOG_VERBOSE() << TRACE(msg.m_ID.m_Height); + BEAM_LOG_VERBOSE() << TRACE(msg.m_ID.m_Height); Send(msg); } @@ -206,7 +206,7 @@ namespace beam virtual void OnMsg(proto::GetHdr&& msg) override { - LOG_VERBOSE() << TRACE(m_In) << TRACE(msg.m_ID.m_Height); + BEAM_LOG_VERBOSE() << TRACE(m_In) << TRACE(msg.m_ID.m_Height); if (msg.m_ID.m_Height != m_In) { printf("OnMsg gap: %u - %u\n", m_In, (uint32_t) msg.m_ID.m_Height); @@ -254,9 +254,9 @@ namespace beam int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = beam::Logger::create(logLevel, logLevel); diff --git a/node/unittests/node_test.cpp b/node/unittests/node_test.cpp index faf133a72..ee47cf8b0 100644 --- a/node/unittests/node_test.cpp +++ b/node/unittests/node_test.cpp @@ -3209,7 +3209,7 @@ namespace beam verify_test((p.m_SpendKeys.size() == 1) && p.m_Utxos && p.m_UtxosCA && p.m_Assets && p.m_ShieldedOuts && p.m_ShieldedIns); - auto logger = beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG); + auto logger = beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG); node.PrintTxos(); NodeProcessor& proc = node.get_Processor(); @@ -3871,7 +3871,7 @@ void TestAll() bool bClientProtoOnly = false; - //auto logger = beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG); + //auto logger = beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG); if (!bClientProtoOnly) beam::PrintEmissionSchedule(); @@ -3959,7 +3959,7 @@ void TestAll() beam::TestNodeClientProto(); { - auto logger = beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG); + auto logger = beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG); { // test migration diff --git a/node/utils/laser_beam_demo.cpp b/node/utils/laser_beam_demo.cpp index b91112fa8..24ab8d0eb 100644 --- a/node/utils/laser_beam_demo.cpp +++ b/node/utils/laser_beam_demo.cpp @@ -636,7 +636,7 @@ void TestDirector::Run() void Test() { - // auto logger = Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG); + // auto logger = Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG); Rules::get().pForks[1].m_Height = 1; Rules::get().pForks[2].m_Height = 1; diff --git a/node/utils/node_net_sim.cpp b/node/utils/node_net_sim.cpp index 409f27b2b..edda66dcd 100644 --- a/node/utils/node_net_sim.cpp +++ b/node/utils/node_net_sim.cpp @@ -935,7 +935,7 @@ int main_Guarded(int argc, char* argv[]) io::Reactor::Scope scope(*pReactor); io::Reactor::GracefulIntHandler gih(*pReactor); - auto logger = beam::Logger::create(LOG_LEVEL_INFO, LOG_LEVEL_INFO); + auto logger = beam::Logger::create(BEAM_LOG_LEVEL_INFO, BEAM_LOG_LEVEL_INFO); const char szLocalMode[] = "local_mode"; diff --git a/node/utils/pipe_link.cpp b/node/utils/pipe_link.cpp index d8d79e85b..5d3d02d48 100644 --- a/node/utils/pipe_link.cpp +++ b/node/utils/pipe_link.cpp @@ -927,7 +927,7 @@ int main_Guarded(int argc, char* argv[]) io::Reactor::Scope scope(*pReactor); io::Reactor::GracefulIntHandler gih(*pReactor); - //auto logger = beam::Logger::create(LOG_LEVEL_INFO, LOG_LEVEL_INFO); + //auto logger = beam::Logger::create(BEAM_LOG_LEVEL_INFO, BEAM_LOG_LEVEL_INFO); Manager man; man.m_AssumeSynced = true; diff --git a/p2p/protocol_base.cpp b/p2p/protocol_base.cpp index 89e95472a..0691a5ca2 100644 --- a/p2p/protocol_base.cpp +++ b/p2p/protocol_base.cpp @@ -20,14 +20,14 @@ namespace beam { bool ProtocolBase::on_new_message(uint64_t fromStream, MsgType type, const void* data, size_t size) { OnRawMessage callback = _dispatchTable[type].callback; if (!callback) { - LOG_WARNING() << "Unexpected msg type " << int(type); + BEAM_LOG_WARNING() << "Unexpected msg type " << int(type); _errorHandler.on_protocol_error(fromStream, ProtocolError::msg_type_error); return false; } - LOG_VERBOSE() << __FUNCTION__ << TRACE(int(type)); + BEAM_LOG_VERBOSE() << __FUNCTION__ << TRACE(int(type)); bool ret = callback(_dispatchTable[type].msgHandler, _errorHandler, *_deserializer, fromStream, data, size); if (!ret) { - LOG_VERBOSE() << "err " << __FUNCTION__ << TRACE(int(type)) << TRACE(ret); + BEAM_LOG_VERBOSE() << "err " << __FUNCTION__ << TRACE(int(type)) << TRACE(ret); } return ret; } diff --git a/p2p/unittest/dialog_test.cpp b/p2p/unittest/dialog_test.cpp index 8b82bdc21..71e135876 100644 --- a/p2p/unittest/dialog_test.cpp +++ b/p2p/unittest/dialog_test.cpp @@ -176,16 +176,16 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // handles deserialization errors, may optionally notify the logic about that void on_protocol_error(uint64_t fromStream, ProtocolError error) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << static_cast(error) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << static_cast(error) << ")"; } // handles network errors, may optionally notify the logic about that void on_connection_error(uint64_t fromStream, io::ErrorCode errorCode) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << io::error_str(errorCode) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << io::error_str(errorCode) << ")"; } void on_unexpected_msg(uint64_t fromStream, MsgType type) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << unsigned(type) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << unsigned(type) << ")"; } void send_request(PeerLocator to, Request&& req) override { @@ -198,7 +198,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // not needed any more (in this test) msgToSend.clear(); } else { - LOG_ERROR() << "No connection"; + BEAM_LOG_ERROR() << "No connection"; // add some handling } } @@ -212,7 +212,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // not needed any more (in this test) msgToSend.clear(); } else { - LOG_ERROR() << "No connection"; + BEAM_LOG_ERROR() << "No connection"; // add some handling } } @@ -282,7 +282,7 @@ struct EventDrivenAppLogic : INetworkToLogic { void on_timer() { if (counter > 10) { - LOG_INFO() << "stopping"; + BEAM_LOG_INFO() << "stopping"; stop(); return; } @@ -294,13 +294,13 @@ struct EventDrivenAppLogic : INetworkToLogic { } void handle_request(PeerLocator from, Request&& req) override { - LOG_INFO() << "Request from " << from << " x=" << req.x << " size=" << req.ooo.size(); + BEAM_LOG_INFO() << "Request from " << from << " x=" << req.x << " size=" << req.ooo.size(); Response res { req.x, req.ooo.size() }; if (proxy) proxy->send_response(from, std::move(res)); } void handle_response(PeerLocator from, Response&& res) override { - LOG_INFO() << "Response from " << from << " x=" << res.x << " z=" << res.z; + BEAM_LOG_INFO() << "Response from " << from << " x=" << res.x << " z=" << res.z; } }; @@ -325,9 +325,9 @@ struct App { }; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); try { @@ -340,20 +340,20 @@ int main() { // client App app2(io::Address::localhost().port(port), false, 83); - LOG_INFO() << "Starting apps"; + BEAM_LOG_INFO() << "Starting apps"; app1.run(); app2.run(); - LOG_INFO() << "Waiting"; + BEAM_LOG_INFO() << "Waiting"; app1.wait(); app2.wait(); - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } catch (const std::exception& e) { - LOG_ERROR() << "Exception: " << e.what(); + BEAM_LOG_ERROR() << "Exception: " << e.what(); } catch (...) { - LOG_ERROR() << "Unknown exception"; + BEAM_LOG_ERROR() << "Unknown exception"; } } diff --git a/p2p/unittest/filesend_test.cpp b/p2p/unittest/filesend_test.cpp index c2edd8000..8fc42c85e 100644 --- a/p2p/unittest/filesend_test.cpp +++ b/p2p/unittest/filesend_test.cpp @@ -196,16 +196,16 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // handles deserialization errors, may optionally notify the logic about that void on_protocol_error(uint64_t fromStream, ProtocolError error) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << static_cast(error) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << static_cast(error) << ")"; } // handles network errors, may optionally notify the logic about that void on_connection_error(uint64_t fromStream, io::ErrorCode errorCode) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << io::error_str(errorCode) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << io::error_str(errorCode) << ")"; } void on_unexpected_msg(uint64_t fromStream, MsgType type) override { - LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << unsigned(type) << ")"; + BEAM_LOG_ERROR() << __FUNCTION__ << "(" << fromStream << "," << unsigned(type) << ")"; } io::SharedBuffer map_file(const char* path) { @@ -213,7 +213,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC try { ret = io::map_file_read_only(path); } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return ret; } @@ -227,7 +227,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // not needed any more (in this test) msgToSend.clear(); } else { - LOG_ERROR() << "No connection"; + BEAM_LOG_ERROR() << "No connection"; // add some handling } } @@ -246,7 +246,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC // not needed any more (in this test) msgToSend.clear(); } else { - LOG_ERROR() << "No connection"; + BEAM_LOG_ERROR() << "No connection"; // add some handling } } @@ -268,7 +268,7 @@ struct NetworkSide : public IErrorHandler, public ILogicToNetwork, public AsyncC io::SharedBuffer buf = map_file(res.filename.c_str()); auto h = checksum(buf); if (h != res.checksum) { - LOG_ERROR() << "Response checksum mismatch"; + BEAM_LOG_ERROR() << "Response checksum mismatch"; } proxy.handle_response(someId, std::move(res)); @@ -323,7 +323,7 @@ struct EventDrivenAppLogic : INetworkToLogic { void on_timer() { if (++counter > 2) { - LOG_INFO() << "stopping"; + BEAM_LOG_INFO() << "stopping"; stop(); return; } @@ -336,14 +336,14 @@ struct EventDrivenAppLogic : INetworkToLogic { } void handle_request(PeerLocator from, Request&& req) override { - LOG_INFO() << "Request from " << from << " f=" << req.filename; + BEAM_LOG_INFO() << "Request from " << from << " f=" << req.filename; Response res; res.filename = req.filename; if (proxy) proxy->send_response(from, std::move(res)); } void handle_response(PeerLocator from, Response&& res) override { - LOG_INFO() << "Response from " << from << " f=" << res.filename << " s=" << res.file.size; + BEAM_LOG_INFO() << "Response from " << from << " f=" << res.filename << " s=" << res.file.size; } }; @@ -368,9 +368,9 @@ struct App { }; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); try { @@ -383,20 +383,20 @@ int main() { // client App app2(io::Address::localhost().port(port), false, 731); - LOG_INFO() << "Starting apps"; + BEAM_LOG_INFO() << "Starting apps"; app1.run(); app2.run(); - LOG_INFO() << "Waiting"; + BEAM_LOG_INFO() << "Waiting"; app1.wait(); app2.wait(); - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } catch (const std::exception& e) { - LOG_ERROR() << "Exception: " << e.what(); + BEAM_LOG_ERROR() << "Exception: " << e.what(); } catch (...) { - LOG_ERROR() << "Unknown exception"; + BEAM_LOG_ERROR() << "Unknown exception"; } } diff --git a/pow/external_pow_stub.cpp b/pow/external_pow_stub.cpp index 9a3479122..11c327190 100644 --- a/pow/external_pow_stub.cpp +++ b/pow/external_pow_stub.cpp @@ -17,7 +17,7 @@ class ExternalPOWStub : public IExternalPOW { ~ExternalPOWStub() override { stop(); _thread.join(); - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } private: @@ -93,14 +93,14 @@ class ExternalPOWStub : public IExternalPOW { auto cancelFn = [this, &job](bool)->bool { if (_changed.load()) { - LOG_INFO() << "job id=" << job.jobID << " cancelled"; + BEAM_LOG_INFO() << "job id=" << job.jobID << " cancelled"; return true; } return false; }; while (get_new_job(job)) { - LOG_INFO() << "solving job id=" << job.jobID + BEAM_LOG_INFO() << "solving job id=" << job.jobID << " with nonce=" << job.pow.m_Nonce << " and difficulty=" << job.pow.m_Difficulty << " and height=" << job.height; diff --git a/pow/miner_client.cpp b/pow/miner_client.cpp index 4ffb542a8..c4faa5c0a 100644 --- a/pow/miner_client.cpp +++ b/pow/miner_client.cpp @@ -84,7 +84,7 @@ class StratumClient : public stratum::ParserCallback { Block::PoW pow; pow.m_Difficulty.m_Packed = job.difficulty; - LOG_INFO() << "new job here: id=" << job.id; + BEAM_LOG_INFO() << "new job here: id=" << job.id; if (!fill_job_info(job)) return false; @@ -110,7 +110,7 @@ class StratumClient : public stratum::ParserCallback { Height h; _miner->get_last_found_block(jobID, h, _lastFoundBlock); if (jobID != _lastJobID) { - LOG_INFO() << "solution expired" << TRACE(jobID); + BEAM_LOG_INFO() << "solution expired" << TRACE(jobID); return IExternalPOW::solution_expired; } @@ -118,10 +118,10 @@ class StratumClient : public stratum::ParserCallback { //LOG_DEBUG() << "input=" << to_hex(buf, _lastJobInput.m_pData, 32); if (!_fakeSolver && !_lastFoundBlock.IsValid(_lastJobInput.m_pData, 32, h)) { - LOG_ERROR() << "solution is invalid, id=" << _lastJobID; + BEAM_LOG_ERROR() << "solution is invalid, id=" << _lastJobID; return IExternalPOW::solution_rejected; } - LOG_INFO() << "block found id=" << _lastJobID; + BEAM_LOG_INFO() << "block found id=" << _lastJobID; _blockSent = false; send_last_found_block(); @@ -132,7 +132,7 @@ class StratumClient : public stratum::ParserCallback { if (_blockSent || !_connection || !_connection->is_connected()) return; stratum::Solution sol(_lastJobID, _lastFoundBlock); if (!stratum::append_json_msg(_lineProtocol, sol)) { - LOG_ERROR() << "Internal error"; + BEAM_LOG_ERROR() << "Internal error"; _reactor.stop(); return; } @@ -141,23 +141,23 @@ class StratumClient : public stratum::ParserCallback { bool on_stratum_error(stratum::ResultCode code) override { if (code == stratum::login_failed) { - LOG_ERROR() << "login to " << _serverAddress << " failed, try again later"; + BEAM_LOG_ERROR() << "login to " << _serverAddress << " failed, try again later"; return false; } // TODO what to do with other errors - LOG_ERROR() << "got stratum error: " << code << " " << stratum::get_result_msg(code); + BEAM_LOG_ERROR() << "got stratum error: " << code << " " << stratum::get_result_msg(code); return true; } bool on_unsupported_stratum_method(stratum::Method method) override { - LOG_INFO() << "ignoring unsupported stratum method: " << stratum::get_method_str(method); + BEAM_LOG_INFO() << "ignoring unsupported stratum method: " << stratum::get_method_str(method); return true; } void on_write(io::SharedBuffer&& msg) { if (_connection) { - LOG_VERBOSE() << "writing " << std::string((const char*)msg.data, msg.size - 1); + BEAM_LOG_VERBOSE() << "writing " << std::string((const char*)msg.data, msg.size - 1); auto result = _connection->write(msg); if (!result) { on_disconnected(result.error()); @@ -170,15 +170,15 @@ class StratumClient : public stratum::ParserCallback { } void on_disconnected(io::ErrorCode error) { - LOG_INFO() << "disconnected, error=" << io::error_str(error) << ", rescheduling"; + BEAM_LOG_INFO() << "disconnected, error=" << io::error_str(error) << ", rescheduling"; _connection.reset(); _timer->start(RECONNECT_TIMEOUT, false, BIND_THIS_MEMFN(on_reconnect)); } void on_reconnect() { - LOG_INFO() << "connecting to " << _serverAddress; + BEAM_LOG_INFO() << "connecting to " << _serverAddress; if (!_reactor.tcp_connect(_serverAddress, 1, BIND_THIS_MEMFN(on_connected), 10000, io::TlsConfig(_tls))) { - LOG_ERROR() << "connect attempt failed, rescheduling"; + BEAM_LOG_ERROR() << "connect attempt failed, rescheduling"; _timer->start(RECONNECT_TIMEOUT, false, BIND_THIS_MEMFN(on_reconnect)); } } @@ -189,13 +189,13 @@ class StratumClient : public stratum::ParserCallback { return; } - LOG_INFO() << "connected to " << _serverAddress; + BEAM_LOG_INFO() << "connected to " << _serverAddress; _connection = std::move(newStream); _connection->enable_keepalive(2); _connection->enable_read(BIND_THIS_MEMFN(on_stream_data)); if (!stratum::append_json_msg(_lineProtocol, stratum::Login(_apiKey))) { - LOG_ERROR() << "Internal error"; + BEAM_LOG_ERROR() << "Internal error"; _reactor.stop(); } if (!_blockSent) { @@ -211,7 +211,7 @@ class StratumClient : public stratum::ParserCallback { return false; } if (!_lineProtocol.new_data_from_stream(data, size)) { - LOG_ERROR() << "closing connection"; + BEAM_LOG_ERROR() << "closing connection"; _reactor.stop(); return false; } @@ -226,7 +226,7 @@ struct Options { std::string serverAddress; bool no_tls=false; bool fake=false; - int logLevel=LOG_LEVEL_DEBUG; + int logLevel=BEAM_LOG_LEVEL_DEBUG; unsigned logRotationPeriod = 3*60*60*1000; // 3 hours }; @@ -242,7 +242,7 @@ int main(int argc, char* argv[]) { std::string logFilePrefix("miner_client_"); logFilePrefix += std::to_string(uv_os_getpid()); logFilePrefix += "_"; - auto logger = Logger::create(LOG_LEVEL_INFO, options.logLevel, options.logLevel, logFilePrefix, "logs"); + auto logger = Logger::create(BEAM_LOG_LEVEL_INFO, options.logLevel, options.logLevel, logFilePrefix, "logs"); int retCode = 0; try { io::Reactor::Ptr reactor = io::Reactor::create(); @@ -258,12 +258,12 @@ int main(int argc, char* argv[]) { ); StratumClient client(*reactor, connectTo, options.apiKey, options.no_tls, options.fake); reactor->run(); - LOG_INFO() << "stopping..."; + BEAM_LOG_INFO() << "stopping..."; } catch (const std::exception& e) { - LOG_ERROR() << "EXCEPTION: " << e.what(); + BEAM_LOG_ERROR() << "EXCEPTION: " << e.what(); retCode = 255; } catch (...) { - LOG_ERROR() << "NON_STD EXCEPTION"; + BEAM_LOG_ERROR() << "NON_STD EXCEPTION"; retCode = 255; } return retCode; @@ -281,12 +281,12 @@ bool parse_cmdline(int argc, char* argv[], Options& o) { ; #ifdef NDEBUG - o.logLevel = LOG_LEVEL_DEBUG; + o.logLevel = BEAM_LOG_LEVEL_DEBUG; #else #if LOG_VERBOSE_ENABLED - o.logLevel = LOG_LEVEL_VERBOSE; + o.logLevel = BEAM_LOG_LEVEL_VERBOSE; #else - o.logLevel = LOG_LEVEL_DEBUG; + o.logLevel = BEAM_LOG_LEVEL_DEBUG; #endif #endif diff --git a/pow/opencl_pow.cpp b/pow/opencl_pow.cpp index 923e00412..c5ec9b5cf 100644 --- a/pow/opencl_pow.cpp +++ b/pow/opencl_pow.cpp @@ -122,7 +122,7 @@ namespace beam { stop(); _thread.join(); _minerThread.join(); - LOG_INFO() << "OpenCLMiner is done"; + BEAM_LOG_INFO() << "OpenCLMiner is done"; } private: @@ -224,21 +224,21 @@ namespace beam { - LOG_INFO() << "Setup OpenCL devices:"; - LOG_INFO() << "====================="; + BEAM_LOG_INFO() << "Setup OpenCL devices:"; + BEAM_LOG_INFO() << "====================="; _ClHost.setup(&_workProvider, _devices, cpuMine); - LOG_INFO() << "Waiting for work:"; - LOG_INFO() << "=============================="; + BEAM_LOG_INFO() << "Waiting for work:"; + BEAM_LOG_INFO() << "=============================="; while (!_workProvider.hasWork()) { this_thread::sleep_for(chrono::milliseconds(200)); } - LOG_INFO() << "Start mining:"; - LOG_INFO() << "============="; + BEAM_LOG_INFO() << "Start mining:"; + BEAM_LOG_INFO() << "============="; _ClHost.startMining(); } diff --git a/pow/stratum.cpp b/pow/stratum.cpp index c4bfa5293..643974313 100644 --- a/pow/stratum.cpp +++ b/pow/stratum.cpp @@ -78,7 +78,7 @@ ResultCode parse_json(const void* buf, size_t bufSize, json& o) { try { o = json::parse(bufc, bufc + bufSize); } catch (const std::exception& e) { - LOG_ERROR() << "json parse: " << e.what() << "\n" << std::string(bufc, bufc + (bufSize > 1024 ? 1024 : bufSize)); + BEAM_LOG_ERROR() << "json parse: " << e.what() << "\n" << std::string(bufc, bufc + (bufSize > 1024 ? 1024 : bufSize)); return message_corrupted; } return no_error; @@ -98,7 +98,7 @@ ResultCode parse_base(const json& o, Message& m) { m.method = get_method(m.method_str); if (m.method == 0) return unknown_method; } catch (const std::exception& e) { - LOG_ERROR() << "json parse: " << e.what(); + BEAM_LOG_ERROR() << "json parse: " << e.what(); return message_corrupted; } return no_error; @@ -252,7 +252,7 @@ bool parse_json_msg(const void* buf, size_t bufSize, ParserCallback& callback) { default:break; } } catch (const std::exception& e) { - LOG_ERROR() << "json parse: " << e.what(); + BEAM_LOG_ERROR() << "json parse: " << e.what(); } return false; } diff --git a/pow/stratum_server.cpp b/pow/stratum_server.cpp index e40077fc5..23c1fabb7 100644 --- a/pow/stratum_server.cpp +++ b/pow/stratum_server.cpp @@ -66,7 +66,7 @@ Server::Server(const IExternalPOW::Options& o, io::Reactor& reactor, io::Address void Server::start_server() { try { if (_options.privKeyFile.empty() || _options.certFile.empty()) { - LOG_WARNING() << STS << "TLS disabled!"; + BEAM_LOG_WARNING() << STS << "TLS disabled!"; _server = io::TcpServer::create( _reactor, _bindAddress, @@ -81,9 +81,9 @@ void Server::start_server() { _options.privKeyFile.c_str() ); } - LOG_INFO() << STS << "listens to " << _bindAddress; + BEAM_LOG_INFO() << STS << "listens to " << _bindAddress; } catch (const std::exception& e) { - LOG_ERROR() << STS << "cannot start server: " << e.what() << " restarting in " << SERVER_RESTART_INTERVAL << " msec"; + BEAM_LOG_ERROR() << STS << "cannot start server: " << e.what() << " restarting in " << SERVER_RESTART_INTERVAL << " msec"; _timers.set_timer(SERVER_RESTART_TIMER, SERVER_RESTART_INTERVAL, BIND_THIS_MEMFN(start_server)); } } @@ -104,7 +104,7 @@ void Server::on_stream_accepted(io::TcpStream::Ptr&& newStream, io::ErrorCode er std::move(newStream) ); } else { - LOG_ERROR() << STS << io::error_str(errorCode) << ", restarting server in " << SERVER_RESTART_INTERVAL << " msec"; + BEAM_LOG_ERROR() << STS << io::error_str(errorCode) << ", restarting server in " << SERVER_RESTART_INTERVAL << " msec"; _timers.set_timer(SERVER_RESTART_TIMER, SERVER_RESTART_INTERVAL, BIND_THIS_MEMFN(start_server)); } } @@ -131,7 +131,7 @@ bool Server::on_login(uint64_t from, const Login& login) { conn->set_logged_in(); loginSuccess = true; } else { - LOG_INFO() << STS << "peer login failed, key=" << login.api_key; + BEAM_LOG_INFO() << STS << "peer login failed, key=" << login.api_key; } Result res(login.id, loginSuccess ? stratum::no_error : stratum::login_failed); @@ -170,7 +170,7 @@ bool Server::on_solution(uint64_t from, const Solution& sol) { _recentResult.id = sol.id; sol.fill_pow(_recentResult.pow); - LOG_INFO() << STS << "solution to " << sol.id << " from " << io::Address::from_u64(from); + BEAM_LOG_INFO() << STS << "solution to " << sol.id << " from " << io::Address::from_u64(from); IExternalPOW::BlockFoundResult result = _recentResult.onBlockFound(); stratum::ResultCode stratumCode = stratum::solution_rejected; if (result == IExternalPOW::solution_accepted) { @@ -189,7 +189,7 @@ bool Server::on_solution(uint64_t from, const Solution& sol) { } void Server::on_bad_peer(uint64_t from) { - LOG_INFO() << STS << "-peer " << io::Address::from_u64(from); + BEAM_LOG_INFO() << STS << "-peer " << io::Address::from_u64(from); _connections.erase(from); } @@ -205,7 +205,7 @@ void Server::new_job( _recentResult.onBlockFound = callback; _recentResult.height = height; - LOG_INFO() << STS << "new job " << id << " will be sent to " << _connections.size() << " connected peers"; + BEAM_LOG_INFO() << STS << "new job " << id << " will be sent to " << _connections.size() << " connected peers"; Job jobMsg(id, input, pow, height); append_json_msg(_fw, jobMsg); @@ -274,7 +274,7 @@ void Server::AccessControl::refresh() { } _keys.swap(keys); } catch (std::exception& e) { - LOG_ERROR() << STS << e.what(); + BEAM_LOG_ERROR() << STS << e.what(); } } @@ -299,7 +299,7 @@ Server::Connection::Connection( bool Server::Connection::on_stream_data(io::ErrorCode errorCode, void* data, size_t size) { if (errorCode != 0) { - LOG_INFO() << STS << "peer disconnected, code=" << io::error_str(errorCode); + BEAM_LOG_INFO() << STS << "peer disconnected, code=" << io::error_str(errorCode); _owner.on_bad_peer(_id); return false; } @@ -328,18 +328,18 @@ bool Server::Connection::on_message(const stratum::Solution& solution) { } bool Server::Connection::on_raw_message(void* data, size_t size) { - LOG_VERBOSE() << "got " << std::string((char*)data, size-1); + BEAM_LOG_VERBOSE() << "got " << std::string((char*)data, size-1); return stratum::parse_json_msg(data, size, *this); } bool Server::Connection::on_stratum_error(stratum::ResultCode code) { // TODO what to do with other errors - LOG_ERROR() << STS << "got stratum error: " << code << " " << stratum::get_result_msg(code); + BEAM_LOG_ERROR() << STS << "got stratum error: " << code << " " << stratum::get_result_msg(code); return true; } bool Server::Connection::on_unsupported_stratum_method(stratum::Method method) { - LOG_INFO() << STS << "ignoring unsupported stratum method: " << stratum::get_method_str(method); + BEAM_LOG_INFO() << STS << "ignoring unsupported stratum method: " << stratum::get_method_str(method); return true; } diff --git a/pow/unittests/server_stub.cpp b/pow/unittests/server_stub.cpp index 4d04007d4..9dbe701ae 100644 --- a/pow/unittests/server_stub.cpp +++ b/pow/unittests/server_stub.cpp @@ -57,7 +57,7 @@ IExternalPOW::BlockFoundResult got_new_block() { Height h; server->get_last_found_block(blockId, h, POW); if (POW.IsValid(hash.m_pData, 32, h)) { - LOG_INFO() << "got valid block" << TRACE(blockId); + BEAM_LOG_INFO() << "got valid block" << TRACE(blockId); result = IExternalPOW::solution_accepted; } gen_new_job(); @@ -114,7 +114,7 @@ void run_with_node() { Rules::get().DA.Difficulty0 = 0; Rules::get().UpdateChecksum(); - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); Node node; node.m_Cfg.m_sPathLocal = "xxxxx"; @@ -147,7 +147,7 @@ void run_with_node() { int main(int argc, char* argv[]) { ECC::InitializeContext(); - auto logger = Logger::create(LOG_LEVEL_INFO, LOG_LEVEL_VERBOSE); + auto logger = Logger::create(BEAM_LOG_LEVEL_INFO, BEAM_LOG_LEVEL_VERBOSE); int retCode = 0; try { if (argc > 1 && argv[1] == std::string("-n")) { @@ -155,12 +155,12 @@ int main(int argc, char* argv[]) { } else { run_without_node(); } - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } catch (const std::exception& e) { - LOG_ERROR() << "EXCEPTION: " << e.what(); + BEAM_LOG_ERROR() << "EXCEPTION: " << e.what(); retCode = 255; } catch (...) { - LOG_ERROR() << "NON_STD EXCEPTION"; + BEAM_LOG_ERROR() << "NON_STD EXCEPTION"; retCode = 255; } return retCode; diff --git a/pow/unittests/stratum_test.cpp b/pow/unittests/stratum_test.cpp index b31991d09..932b10cd0 100644 --- a/pow/unittests/stratum_test.cpp +++ b/pow/unittests/stratum_test.cpp @@ -48,13 +48,13 @@ int json_creation_test() { Result x; auto code = parse_json_msg(buf.data, buf.size, x); if (code != 0) { - LOG_ERROR() << "parse_json_msg failed, error=" << get_result_msg(code); + BEAM_LOG_ERROR() << "parse_json_msg failed, error=" << get_result_msg(code); ++nErrors; } else if (x.id != r.id || x.method != r.method) { - LOG_ERROR() << "messages dont match"; + BEAM_LOG_ERROR() << "messages dont match"; } } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); nErrors = 255; } @@ -109,9 +109,9 @@ void gen_examples() { } //namespace int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); auto res = json_creation_test(); diff --git a/utility/asynccontext.cpp b/utility/asynccontext.cpp index 85fc6d0ae..60ca69e4d 100644 --- a/utility/asynccontext.cpp +++ b/utility/asynccontext.cpp @@ -76,10 +76,10 @@ void AsyncContext::thread_func(AsyncContext::RunCallback&& beforeRun, AsyncConte _reactor->run(); if (afterRun) afterRun(); } catch (const std::exception& e) { - LOG_CRITICAL() << "Unhandled exception in child thread, what=" << e.what(); + BEAM_LOG_CRITICAL() << "Unhandled exception in child thread, what=" << e.what(); assert(false && "exception in child thread"); } catch (...) { - LOG_CRITICAL() << "Unhandled non-std exception in child thread"; + BEAM_LOG_CRITICAL() << "Unhandled non-std exception in child thread"; assert(false && "exception in child thread"); } LOG_DEBUG() << "exiting, thread=" << get_thread_id(); diff --git a/utility/cli/options.cpp b/utility/cli/options.cpp index a031d7d59..2d238fe5c 100644 --- a/utility/cli/options.cpp +++ b/utility/cli/options.cpp @@ -842,11 +842,11 @@ namespace beam { const map logLevels { - { cli::LOG_ERROR, LOG_LEVEL_ERROR }, - { cli::LOG_WARNING, LOG_LEVEL_WARNING }, - { cli::LOG_DEBUG, LOG_LEVEL_DEBUG }, - { cli::INFO, LOG_LEVEL_INFO }, - { cli::LOG_VERBOSE, LOG_LEVEL_VERBOSE } + { cli::LOG_ERROR, BEAM_LOG_LEVEL_ERROR }, + { cli::LOG_WARNING, BEAM_LOG_LEVEL_WARNING }, + { cli::LOG_DEBUG, BEAM_LOG_LEVEL_DEBUG }, + { cli::INFO, BEAM_LOG_LEVEL_INFO }, + { cli::LOG_VERBOSE, BEAM_LOG_LEVEL_VERBOSE } }; if (vm.count(dstLog)) diff --git a/utility/cli/options.h b/utility/cli/options.h index 7c72545a3..3c2da9d1c 100644 --- a/utility/cli/options.h +++ b/utility/cli/options.h @@ -338,7 +338,7 @@ namespace beam boost::optional ReadCfgFromFile(po::variables_map&, const po::options_description&, const char* szFile); boost::optional ReadCfgFromFileCommon(po::variables_map&, const po::options_description&); - int getLogLevel(const std::string &dstLog, const po::variables_map& vm, int defaultValue = LOG_LEVEL_DEBUG); + int getLogLevel(const std::string &dstLog, const po::variables_map& vm, int defaultValue = BEAM_LOG_LEVEL_DEBUG); std::vector getCfgPeers(const po::variables_map& vm); diff --git a/utility/io/coarsetimer.cpp b/utility/io/coarsetimer.cpp index 8e8b8bfac..6e102c83d 100644 --- a/utility/io/coarsetimer.cpp +++ b/utility/io/coarsetimer.cpp @@ -63,7 +63,7 @@ Result CoarseTimer::set_timer(unsigned intervalMsec, ID id) { _queue.insert({ clock, id }); _validIds.insert({ id, clock }); if (!_insideCallback && _timerSetTo > clock) { - LOG_VERBOSE() << TRACE(intervalMsec); + BEAM_LOG_VERBOSE() << TRACE(intervalMsec); _timerSetTo = clock; return _timer->restart(intervalMsec, false); } @@ -88,7 +88,7 @@ void CoarseTimer::cancel_all() { static constexpr unsigned TIMER_ACCURACY = 10; void CoarseTimer::on_timer() { - LOG_VERBOSE() << TRACE(_queue.size()); + BEAM_LOG_VERBOSE() << TRACE(_queue.size()); if (_queue.empty()) return; Clock now = mono_clock(); @@ -102,12 +102,12 @@ void CoarseTimer::on_timer() { clock = it->first; - LOG_VERBOSE() << TRACE(now) << TRACE(clock) << TRACE(_timerSetTo); + BEAM_LOG_VERBOSE() << TRACE(now) << TRACE(clock) << TRACE(_timerSetTo); if (clock > now + TIMER_ACCURACY) break; ID id = it->second; - LOG_VERBOSE() << TRACE(id); + BEAM_LOG_VERBOSE() << TRACE(id); // this helps calling set_timer(), cancel(), cancel_all() from inside callbacks _queue.erase(it); @@ -129,10 +129,10 @@ void CoarseTimer::on_timer() { now = mono_clock(); unsigned intervalMsec = 0; if (clock > now) intervalMsec = unsigned(clock - now); - LOG_VERBOSE() << TRACE(intervalMsec); + BEAM_LOG_VERBOSE() << TRACE(intervalMsec); Result res =_timer->restart(intervalMsec, false); if (!res) { - LOG_ERROR() << "cannot restart timer, code=" << res.error(); + BEAM_LOG_ERROR() << "cannot restart timer, code=" << res.error(); } else { _timerSetTo = now + intervalMsec; } diff --git a/utility/io/json_serializer.cpp b/utility/io/json_serializer.cpp index b11664d82..78ba2582f 100644 --- a/utility/io/json_serializer.cpp +++ b/utility/io/json_serializer.cpp @@ -48,7 +48,7 @@ bool serialize_json_msg(io::FragmentWriter& packer, const nlohmann::json& o) { static const char eol = 10; packer.write(&eol, 1); } catch (const std::exception& e) { - LOG_ERROR() << "dump json: " << e.what(); + BEAM_LOG_ERROR() << "dump json: " << e.what(); result = false; } packer.finalize(); diff --git a/utility/io/proxy_connector.cpp b/utility/io/proxy_connector.cpp index 63de5d74c..a6b92bb55 100644 --- a/utility/io/proxy_connector.cpp +++ b/utility/io/proxy_connector.cpp @@ -33,7 +33,7 @@ ProxyConnector::ProxyConnector(Reactor& r) : ProxyConnector::~ProxyConnector() { if (!_connectRequests.empty()) { - LOG_ERROR() << "proxy connect requests were not cancelled"; + BEAM_LOG_ERROR() << "proxy connect requests were not cancelled"; } } diff --git a/utility/io/reactor.cpp b/utility/io/reactor.cpp index cec7b4deb..c4920cc00 100644 --- a/utility/io/reactor.cpp +++ b/utility/io/reactor.cpp @@ -43,10 +43,10 @@ class TcpConnectors { ~TcpConnectors() { if (!_connectRequests.empty()) { - LOG_ERROR() << "connect requests were not cancelled"; + BEAM_LOG_ERROR() << "connect requests were not cancelled"; } if (!_cancelledConnectRequests.empty()) { - LOG_ERROR() << "callbacks on cancelled requests were not called"; + BEAM_LOG_ERROR() << "callbacks on cancelled requests were not called"; } } @@ -124,7 +124,7 @@ class TcpConnectors { } void cancel_tcp_connect(uint64_t tag) { - LOG_VERBOSE() << TRACE(tag); + BEAM_LOG_VERBOSE() << TRACE(tag); auto it = _connectRequests.find(tag); if (it != _connectRequests.end()) { cancel_tcp_connect_impl(it); @@ -196,7 +196,7 @@ class TcpConnectors { } void connect_timeout_callback(uint64_t tag) { - LOG_VERBOSE() << TRACE(tag); + BEAM_LOG_VERBOSE() << TRACE(tag); auto it = _connectRequests.find(tag); if (it != _connectRequests.end()) { Reactor::ConnectCallback cb = it->second->callback; @@ -359,7 +359,7 @@ Reactor::Reactor() : auto errorCode = (ErrorCode)uv_loop_init(&_loop); if (errorCode != 0) { - LOG_ERROR() << "cannot initialize uv loop, error=" << errorCode; + BEAM_LOG_ERROR() << "cannot initialize uv loop, error=" << errorCode; IO_EXCEPTION(errorCode); } @@ -380,7 +380,7 @@ Reactor::Reactor() : if (errorCode != 0) { uv_loop_close(&_loop); - LOG_ERROR() << "cannot initialize loop stop event, error=" << errorCode; + BEAM_LOG_ERROR() << "cannot initialize loop stop event, error=" << errorCode; IO_EXCEPTION(errorCode); } @@ -575,7 +575,7 @@ TcpStream* Reactor::stream_connected(TcpStream* stream, uv_handle_t* h) { } TcpStream* Reactor::move_stream(TcpStream* newStream, TcpStream* oldStream) { - LOG_VERBOSE() << "move_stream() handle: " << static_cast(oldStream->_handle); + BEAM_LOG_VERBOSE() << "move_stream() handle: " << static_cast(oldStream->_handle); oldStream->disable_read(); newStream->_handle = oldStream->_handle; newStream->_handle->data = newStream; @@ -706,7 +706,7 @@ void Reactor::cancel_tcp_connect(uint64_t tag) { } void Reactor::async_close(uv_handle_t*& handle) { - LOG_VERBOSE() << "async_close " << TRACE(handle); + BEAM_LOG_VERBOSE() << "async_close " << TRACE(handle); if (!handle) return; handle->data = 0; diff --git a/utility/io/sslio.cpp b/utility/io/sslio.cpp index 33f918445..1baba7c9e 100644 --- a/utility/io/sslio.cpp +++ b/utility/io/sslio.cpp @@ -28,7 +28,7 @@ int verify_server(int preverify_ok, X509_STORE_CTX* x509_ctx) { if (!preverify_ok) { int error = X509_STORE_CTX_get_error(x509_ctx); - LOG_ERROR() << "server verification error: " << error << " " << X509_verify_cert_error_string(error); + BEAM_LOG_ERROR() << "server verification error: " << error << " " << X509_verify_cert_error_string(error); } return preverify_ok; } @@ -37,7 +37,7 @@ int verify_client(int preverify_ok, X509_STORE_CTX* x509_ctx) { if (!preverify_ok) { int error = X509_STORE_CTX_get_error(x509_ctx); - LOG_ERROR() << "client verification error: " << error << " " << X509_verify_cert_error_string(error); + BEAM_LOG_ERROR() << "client verification error: " << error << " " << X509_verify_cert_error_string(error); } return preverify_ok; } @@ -72,7 +72,7 @@ void ssl_info(const SSL* ssl, int where, int ret) } } - LOG_VERBOSE() << TRACE(ssl) << " " << ss.str(); + BEAM_LOG_VERBOSE() << TRACE(ssl) << " " << ss.str(); } struct SSLInitializer { @@ -95,7 +95,7 @@ SSLInitializer g_sslInitializer; SSL_CTX* init_ctx(bool isServer) { if (!g_sslInitializer.ok) { - LOG_ERROR() << "SSL init failed"; + BEAM_LOG_ERROR() << "SSL init failed"; IO_EXCEPTION(EC_SSL_ERROR); } @@ -103,11 +103,11 @@ SSL_CTX* init_ctx(bool isServer) { SSL_CTX* ctx = SSL_CTX_new(isServer ? SSLv23_server_method() : SSLv23_client_method()); if (!ctx) { - LOG_ERROR() << "SSL_CTX_new failed"; + BEAM_LOG_ERROR() << "SSL_CTX_new failed"; IO_EXCEPTION(EC_SSL_ERROR); } if (SSL_CTX_set_cipher_list(ctx, cipher_settings) != 1) { - LOG_ERROR() << "SSL_CTX_set_cipher_list failed"; + BEAM_LOG_ERROR() << "SSL_CTX_set_cipher_list failed"; IO_EXCEPTION(EC_SSL_ERROR); } @@ -133,7 +133,7 @@ bool load_system_certificate_authority(SSL_CTX* ctx) if (x509) { int i = X509_STORE_add_cert(store, x509); if (i == 0) { - LOG_ERROR() << "Failed to add certificate from system store"; + BEAM_LOG_ERROR() << "Failed to add certificate from system store"; } X509_free(x509); } @@ -149,15 +149,15 @@ void setup_certificate(SSL_CTX* ctx, const char* certFileName, const char* privK if (certFileName && privKeyFileName) { if (SSL_CTX_use_certificate_file(ctx, certFileName, SSL_FILETYPE_PEM) != 1) { - LOG_ERROR() << "SSL_CTX_use_certificate_file failed, " << certFileName; + BEAM_LOG_ERROR() << "SSL_CTX_use_certificate_file failed, " << certFileName; IO_EXCEPTION(EC_SSL_ERROR); } if (SSL_CTX_use_PrivateKey_file(ctx, privKeyFileName, SSL_FILETYPE_PEM) != 1) { - LOG_ERROR() << "SSL_CTX_use_PrivateKey_file failed " << privKeyFileName; + BEAM_LOG_ERROR() << "SSL_CTX_use_PrivateKey_file failed " << privKeyFileName; IO_EXCEPTION(EC_SSL_ERROR); } if (SSL_CTX_check_private_key(ctx) != 1) { - LOG_ERROR() << "SSL_CTX_check_private_key failed" << privKeyFileName; + BEAM_LOG_ERROR() << "SSL_CTX_check_private_key failed" << privKeyFileName; IO_EXCEPTION(EC_SSL_ERROR); } } @@ -166,7 +166,7 @@ void setup_certificate(SSL_CTX* ctx, const char* certFileName, const char* privK void setup_verification_paths(SSL_CTX* ctx) { if (SSL_CTX_set_default_verify_paths(ctx) != 1) { - LOG_ERROR() << "SSL_CTX_set_default_verify_paths failed"; + BEAM_LOG_ERROR() << "SSL_CTX_set_default_verify_paths failed"; IO_EXCEPTION(EC_SSL_ERROR); } } @@ -238,7 +238,7 @@ SSLIO::SSLIO( { _ssl = SSL_new(_ctx->get()); if (!_ssl) { - LOG_ERROR() << "SSL_new failed"; + BEAM_LOG_ERROR() << "SSL_new failed"; IO_EXCEPTION(EC_SSL_ERROR); } @@ -249,7 +249,7 @@ SSLIO::SSLIO( _rbio = BIO_new(BIO_s_mem()); _wbio = BIO_new(BIO_s_mem()); if (!_rbio || !_wbio) { - LOG_ERROR() << "BIO_new failed"; + BEAM_LOG_ERROR() << "BIO_new failed"; IO_EXCEPTION(EC_SSL_ERROR); } diff --git a/utility/log_rotation.cpp b/utility/log_rotation.cpp index 574bb8c52..cbc0f6bbe 100644 --- a/utility/log_rotation.cpp +++ b/utility/log_rotation.cpp @@ -76,13 +76,13 @@ static void clean_old_logfiles_2(const std::string& directory, const std::string for (const auto& x : days) { if (x.first < cleanPeriodDays) continue; // skip specified working days for (auto& p : x.second) { - LOG_INFO() << "removing old log file " << p; + BEAM_LOG_INFO() << "removing old log file " << p; boost::filesystem::remove_all(p); } } } catch (const boost::exception& e) { - LOG_ERROR() << "cleanup old logs failed, " << boost::diagnostic_information(e); + BEAM_LOG_ERROR() << "cleanup old logs failed, " << boost::diagnostic_information(e); } catch (...) { //~ } diff --git a/utility/logger.h b/utility/logger.h index 6fa8db088..342c5aa90 100644 --- a/utility/logger.h +++ b/utility/logger.h @@ -42,14 +42,14 @@ // API -#define LOG_LEVEL_CRITICAL 6 -#define LOG_LEVEL_ERROR 5 -#define LOG_LEVEL_WARNING 4 -#define LOG_LEVEL_INFO 3 -#define LOG_LEVEL_DEBUG 2 -#define LOG_LEVEL_VERBOSE 1 +#define BEAM_LOG_LEVEL_CRITICAL 6 +#define BEAM_LOG_LEVEL_ERROR 5 +#define BEAM_LOG_LEVEL_WARNING 4 +#define BEAM_LOG_LEVEL_INFO 3 +#define BEAM_LOG_LEVEL_DEBUG 2 +#define BEAM_LOG_LEVEL_VERBOSE 1 -#define LOG_SINK_DISABLED 0 +#define BEAM_LOG_SINK_DISABLED 0 // This stub will be optimized out; struct LogMessageStub { @@ -58,27 +58,27 @@ struct LogMessageStub { }; #if SHOW_CODE_LOCATION - #define LOG_MESSAGE(LEVEL) if (beam::Logger::will_log(LEVEL)) beam::LogMessage(LEVEL, __FILE__, __LINE__, __FUNCTION__) + #define BEAM_LOG_MESSAGE(LEVEL) if (beam::Logger::will_log(LEVEL)) beam::LogMessage(LEVEL, __FILE__, __LINE__, __FUNCTION__) #else - #define LOG_MESSAGE(LEVEL) if (beam::Logger::will_log(LEVEL)) beam::LogMessage(LEVEL) + #define BEAM_LOG_MESSAGE(LEVEL) if (beam::Logger::will_log(LEVEL)) beam::LogMessage(LEVEL) #endif -#define LOG_CRITICAL() LOG_MESSAGE(LOG_LEVEL_CRITICAL) -#define LOG_ERROR() LOG_MESSAGE(LOG_LEVEL_ERROR) -#define LOG_WARNING() LOG_MESSAGE(LOG_LEVEL_WARNING) -#define LOG_INFO() LOG_MESSAGE(LOG_LEVEL_INFO) -#define LOG_UNHANDLED_EXCEPTION() LOG_ERROR() << "["<< __FILE__ << "] [" << __LINE__ << "] [" << __FUNCTION__ << "] unhandled exception. " +#define BEAM_LOG_CRITICAL() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_CRITICAL) +#define BEAM_LOG_ERROR() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_ERROR) +#define BEAM_LOG_WARNING() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_WARNING) +#define BEAM_LOG_INFO() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_INFO) +#define BEAM_LOG_UNHANDLED_EXCEPTION() BEAM_LOG_ERROR() << "["<< __FILE__ << "] [" << __LINE__ << "] [" << __FUNCTION__ << "] unhandled exception. " #if LOG_DEBUG_ENABLED - #define LOG_DEBUG() LOG_MESSAGE(LOG_LEVEL_DEBUG) + #define LOG_DEBUG() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_DEBUG) #else #define LOG_DEBUG() LogMessageStub() #endif #if LOG_VERBOSE_ENABLED - #define LOG_VERBOSE() LOG_MESSAGE(LOG_LEVEL_VERBOSE) + #define BEAM_LOG_VERBOSE() BEAM_LOG_MESSAGE(BEAM_LOG_LEVEL_VERBOSE) #else - #define LOG_VERBOSE() LogMessageStub() + #define BEAM_LOG_VERBOSE() LogMessageStub() #endif #define TRACE(var) " " #var "=" << var @@ -91,9 +91,9 @@ namespace beam { // Logger options struct LoggerConfig { - int fileLevel=LOG_SINK_DISABLED; - int consoleLevel=LOG_LEVEL_DEBUG; - int flushLevel=LOG_LEVEL_WARNING; + int fileLevel=BEAM_LOG_SINK_DISABLED; + int consoleLevel=BEAM_LOG_LEVEL_DEBUG; + int flushLevel=BEAM_LOG_LEVEL_WARNING; std::string filePrefix; // ~etc rotation @@ -132,13 +132,13 @@ class Logger { /// RAII static std::shared_ptr create( // flushes sinks if level >= flushLevel - int flushLevel=LOG_LEVEL_WARNING, + int flushLevel=BEAM_LOG_LEVEL_WARNING, - // default console minimal level, use LOG_SINK_DISABLED to disable console log - int consoleLevel=LOG_LEVEL_DEBUG, + // default console minimal level, use BEAM_LOG_SINK_DISABLED to disable console log + int consoleLevel=BEAM_LOG_LEVEL_DEBUG, - // default file logger minimal level, use LOG_SINK_DISABLED to disable file log - int fileLevel=LOG_SINK_DISABLED, + // default file logger minimal level, use BEAM_LOG_SINK_DISABLED to disable file log + int fileLevel=BEAM_LOG_SINK_DISABLED, // filename prefix, needed if file log enabled const std::string& fileNamePrefix = std::string(), diff --git a/utility/logger_checkpoints.cpp b/utility/logger_checkpoints.cpp index 01f25058d..847db1f90 100644 --- a/utility/logger_checkpoints.cpp +++ b/utility/logger_checkpoints.cpp @@ -32,7 +32,7 @@ void flush_last_checkpoint(LogMessage* to) { } Checkpoint::Checkpoint(detail::CheckpointItem* items, size_t maxItems, const char* file, int line, const char* function) : - _header(LOG_LEVEL_ERROR, file, line, function), _items(items), _ptr(items), _maxItems(maxItems) + _header(BEAM_LOG_LEVEL_ERROR, file, line, function), _items(items), _ptr(items), _maxItems(maxItems) { assert(maxItems > 0); if (currentCheckpoint == 0) { diff --git a/utility/unittest/logger_test.cpp b/utility/unittest/logger_test.cpp index fbd81cae2..21acc1040 100644 --- a/utility/unittest/logger_test.cpp +++ b/utility/unittest/logger_test.cpp @@ -32,21 +32,21 @@ static size_t custom_header_formatter(char* buf, size_t maxSize, const char* tim } void test_logger_1() { - auto logger = Logger::create(LOG_LEVEL_WARNING, LOG_LEVEL_DEBUG, LOG_LEVEL_WARNING, "Zzzzz"); + auto logger = Logger::create(BEAM_LOG_LEVEL_WARNING, BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_WARNING, "Zzzzz"); logger->set_header_formatter(custom_header_formatter); logger->set_time_format("%T", false); - LOG_CRITICAL() << "Let's die"; - LOG_ERROR() << "Not so bad at all, here is " << format_timestamp("%y-%m-%d.%T", local_timestamp_msec()); - LOG_WARNING() << "Don't be afraid: " << 223322223; + BEAM_LOG_CRITICAL() << "Let's die"; + BEAM_LOG_ERROR() << "Not so bad at all, here is " << format_timestamp("%y-%m-%d.%T", local_timestamp_msec()); + BEAM_LOG_WARNING() << "Don't be afraid: " << 223322223; XXX xxx; - LOG_INFO() << xxx; + BEAM_LOG_INFO() << xxx; LOG_DEBUG() << "YYY"; - LOG_VERBOSE() << "ZZZ"; + BEAM_LOG_VERBOSE() << "ZZZ"; } void test_ndc_1() { - auto logger = Logger::create(LOG_LEVEL_WARNING, LOG_LEVEL_DEBUG, LOG_LEVEL_WARNING, "Zzzzz"); + auto logger = Logger::create(BEAM_LOG_LEVEL_WARNING, BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_WARNING, "Zzzzz"); logger->set_header_formatter(custom_header_formatter); CHECKPOINT_CREATE (6); CHECKPOINT_ADD() << "ssss" << 333 << 555; @@ -55,7 +55,7 @@ void test_ndc_1() { std::string zzz("Blablabla"); CHECKPOINT_ADD() << &zzz; // constraint: objects captured by ptr in checkpoints CHECKPOINT (3333, 44444, 5555, 66666, 77777, 88888); - LOG_ERROR() << FlushAllCheckpoints(); + BEAM_LOG_ERROR() << FlushAllCheckpoints(); } void test_ndc_2(bool exc) @@ -72,7 +72,7 @@ void test_ndc_2(bool exc) if (exc) throw("xxx"); CHECKPOINT("Sending a file. Path:", "C:\\Blablabla.bin"); { - LOG_ERROR() << "Can't open file. Error:" << EACCES << FlushAllCheckpoints(); + BEAM_LOG_ERROR() << "Can't open file. Error:" << EACCES << FlushAllCheckpoints(); } } } diff --git a/utility/unittest/proxy_test.cpp b/utility/unittest/proxy_test.cpp index c35d03c48..285401bba 100644 --- a/utility/unittest/proxy_test.cpp +++ b/utility/unittest/proxy_test.cpp @@ -284,9 +284,9 @@ void proxy_test() { int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); diff --git a/utility/unittest/reactor_test.cpp b/utility/unittest/reactor_test.cpp index 065e9ba6e..d4beb53e3 100644 --- a/utility/unittest/reactor_test.cpp +++ b/utility/unittest/reactor_test.cpp @@ -50,7 +50,7 @@ void error_codes_test() { std::string str; #define XX(code, _) \ str = format_io_error("", "", 0, EC_ ## code); \ - LOG_VERBOSE() << str; \ + BEAM_LOG_VERBOSE() << str; \ assert(str.find(unknown_descr) == string::npos); UV_ERRNO_MAP(XX) @@ -58,9 +58,9 @@ void error_codes_test() { } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); reactor_start_stop(); diff --git a/utility/unittest/ssl_test.cpp b/utility/unittest/ssl_test.cpp index d271429b1..108954e0a 100644 --- a/utility/unittest/ssl_test.cpp +++ b/utility/unittest/ssl_test.cpp @@ -26,13 +26,13 @@ namespace { void setup_test_CA(SSL_CTX* ctx, const std::string& caFile) { if (SSL_CTX_load_verify_locations(ctx, caFile.c_str(), nullptr) != 1) { - LOG_ERROR() << "SSL_CTX_load_verify_locations failed" << caFile; + BEAM_LOG_ERROR() << "SSL_CTX_load_verify_locations failed" << caFile; IO_EXCEPTION(EC_SSL_ERROR); } } int test_sslio(bool requestCertificate, bool rejectUnauthorized, const string& serverCertName, const string& clientCertName = "") { - LOG_INFO() << "Testing SSLIO " + BEAM_LOG_INFO() << "Testing SSLIO " << TRACE(requestCertificate) << TRACE(rejectUnauthorized) << TRACE(serverCertName) @@ -116,10 +116,10 @@ namespace { client->flush(); if (expectedSize != receivedSize) { - LOG_ERROR() << TRACE(expectedSize) << TRACE(receivedSize); + BEAM_LOG_ERROR() << TRACE(expectedSize) << TRACE(receivedSize); ++nErrors; } - LOG_INFO() << TRACE(nErrors); + BEAM_LOG_INFO() << TRACE(nErrors); return nErrors; } } @@ -135,9 +135,9 @@ namespace { }\ int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); int retCode = 0; @@ -163,10 +163,10 @@ int main() { CHECK_FALSE(test_sslio(true, true, serverCert, selfSignedCert)); CHECK_TRUE(test_sslio(true, true, serverCert, clientCert)); } catch (const exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); retCode = 255; } catch (...) { - LOG_ERROR() << "non-std exception"; + BEAM_LOG_ERROR() << "non-std exception"; retCode = 255; } return retCode; diff --git a/utility/unittest/tcpclient_test.cpp b/utility/unittest/tcpclient_test.cpp index ee30e8df5..38bebd59f 100644 --- a/utility/unittest/tcpclient_test.cpp +++ b/utility/unittest/tcpclient_test.cpp @@ -43,7 +43,7 @@ bool g_FirstRcv = true; int calc_errors() { int retCode=errorlevel + callbackCount + writecancelInProgress; if (retCode != 0) { - LOG_ERROR() << TRACE(errorlevel) << TRACE(callbackCount) << TRACE(writecancelInProgress); + BEAM_LOG_ERROR() << TRACE(errorlevel) << TRACE(callbackCount) << TRACE(writecancelInProgress); errorlevel=0; callbackCount=0; writecancelInProgress=0; @@ -76,7 +76,7 @@ void on_connected (uint64_t tag, unique_ptr&& newStream, ErrorCode st static const char* request = "GET / HTTP/1.0\r\nHost: " DOMAIN_NAME "\r\n\r\n"; Result res = newStream->write(request, strlen(request)); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } streams.emplace_back(move(newStream)); @@ -89,7 +89,7 @@ void on_connected (uint64_t tag, unique_ptr&& newStream, ErrorCode st }; int tcpclient_test(bool ssl) { - LOG_INFO() << __FUNCTION__ << TRACE(ssl); + BEAM_LOG_INFO() << __FUNCTION__ << TRACE(ssl); callbackCount = 3; g_FirstRcv = true; long reactorUseCount = 0; @@ -134,7 +134,7 @@ int tcpclient_test(bool ssl) { reactorUseCount = reactor.use_count() - 1; } catch (const Exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return reactorUseCount + calc_errors(); @@ -182,7 +182,7 @@ int tcpclient_writecancel_test() { streams.clear(); } catch (const Exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return calc_errors(); @@ -206,7 +206,7 @@ int tcpclient_unclosed_test() { for (uint64_t i=0; i<9; ++i) { auto result = reactor->tcp_connect(a, i, on_connected_dummy, 10000); if (!result) { - LOG_ERROR() << error_descr(result.error()); + BEAM_LOG_ERROR() << error_descr(result.error()); ++errorlevel; } } @@ -225,16 +225,16 @@ int tcpclient_unclosed_test() { streams.clear(); } catch (const Exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } return calc_errors(); } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); diff --git a/utility/unittest/tcpserver_test.cpp b/utility/unittest/tcpserver_test.cpp index 239da40be..662b6e9ce 100644 --- a/utility/unittest/tcpserver_test.cpp +++ b/utility/unittest/tcpserver_test.cpp @@ -56,7 +56,7 @@ void tcpserver_test() { assert(newStream); wasAccepted = true; } else { - LOG_ERROR() << "Error code=" << errorCode; + BEAM_LOG_ERROR() << "Error code=" << errorCode; } reactor->stop(); } @@ -74,14 +74,14 @@ void tcpserver_test() { LOG_DEBUG() << "reactor stopped"; } catch (const std::exception& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); tcpserver_test(); diff --git a/utility/unittest/timer_test.cpp b/utility/unittest/timer_test.cpp index 66e9a1fe9..5fee5fde0 100644 --- a/utility/unittest/timer_test.cpp +++ b/utility/unittest/timer_test.cpp @@ -100,9 +100,9 @@ void coarsetimer_test() { } int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); timer_test(); diff --git a/wallet/api/base/api_base.cpp b/wallet/api/base/api_base.cpp index f691ca79a..2466b0dda 100644 --- a/wallet/api/base/api_base.cpp +++ b/wallet/api/base/api_base.cpp @@ -102,7 +102,7 @@ namespace beam::wallet } catch(...) { - LOG_WARNING() << "ApiBase::fromError - failed to parse request, " << request; + BEAM_LOG_WARNING() << "ApiBase::fromError - failed to parse request, " << request; } const auto err = formError(rpcId, code, errorText); @@ -177,7 +177,7 @@ namespace beam::wallet auto pinfo = parseCallInfo(data, size); if (pinfo == boost::none) { - LOG_WARNING() << "executeAPIRequest, parseCallInfo returned none for " << std::string_view(data, size); + BEAM_LOG_WARNING() << "executeAPIRequest, parseCallInfo returned none for " << std::string_view(data, size); return ApiSyncMode::DoneSync; } @@ -186,7 +186,7 @@ namespace beam::wallet FilterRequest(messageCopy); const auto message = messageCopy.dump(1, '\t'); - LOG_VERBOSE() << "executeAPIRequest:\n" << message; + BEAM_LOG_VERBOSE() << "executeAPIRequest:\n" << message; } const auto result = callGuarded(pinfo->rpcid, [this, &pinfo] () -> ApiSyncMode { diff --git a/wallet/api/base/api_base.h b/wallet/api/base/api_base.h index 5373e2e5a..323efd509 100644 --- a/wallet/api/base/api_base.h +++ b/wallet/api/base/api_base.h @@ -34,8 +34,8 @@ namespace beam::wallet {\ json msg; \ getResponse(id, response, msg); \ - LOG_VERBOSE() << "Api call result for id " << id; \ - LOG_VERBOSE() << "\tresponse: " << std::string_view(msg.dump()).substr(0, 200); \ + BEAM_LOG_VERBOSE() << "Api call result for id " << id; \ + BEAM_LOG_VERBOSE() << "\tresponse: " << std::string_view(msg.dump()).substr(0, 200); \ _handler.sendAPIResponse(msg); \ } diff --git a/wallet/api/cli/api_cli.cpp b/wallet/api/cli/api_cli.cpp index 29236a1af..8ca6ea2e2 100644 --- a/wallet/api/cli/api_cli.cpp +++ b/wallet/api/cli/api_cli.cpp @@ -115,7 +115,7 @@ namespace if (!parsed) { - LOG_ERROR() << "ACL parsing error, line " << curLine; + BEAM_LOG_ERROR() << "ACL parsing error, line " << curLine; return boost::none; } @@ -125,11 +125,11 @@ namespace if (keys.empty()) { - LOG_WARNING() << "ACL file is empty"; + BEAM_LOG_WARNING() << "ACL file is empty"; } else { - LOG_INFO() << "ACL file successfully loaded"; + BEAM_LOG_INFO() << "ACL file successfully loaded"; } return ApiACL(keys); @@ -200,7 +200,7 @@ namespace { if (error.empty()) { - LOG_INFO() << "IPFS peers count: " << peercnt; + BEAM_LOG_INFO() << "IPFS peers count: " << peercnt; return; } @@ -229,7 +229,7 @@ namespace } catch(std::runtime_error& err) { - LOG_ERROR() << err.what(); + BEAM_LOG_ERROR() << err.what(); return false; } } @@ -287,7 +287,7 @@ namespace #endif // BEAM_ASSET_SWAP_SUPPORT void start() { - LOG_INFO() << "Start server on " << _bindAddress; + BEAM_LOG_INFO() << "Start server on " << _bindAddress; try { @@ -300,7 +300,7 @@ namespace } catch (const std::exception& e) { - LOG_ERROR() << "cannot start server: " << e.what(); + BEAM_LOG_ERROR() << "cannot start server: " << e.what(); } } @@ -366,7 +366,7 @@ namespace { if (std::find(_whitelist.begin(), _whitelist.end(), peer.ip()) == _whitelist.end()) { - LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; + BEAM_LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; return; } } @@ -419,14 +419,14 @@ namespace { if (errorCode != 0) { - LOG_INFO() << "peer disconnected, code=" << io::error_str(errorCode); + BEAM_LOG_INFO() << "peer disconnected, code=" << io::error_str(errorCode); closeConnection(); return false; } if (!_lineProtocol.new_data_from_stream(data, size)) { - LOG_INFO() << "stream corrupted"; + BEAM_LOG_INFO() << "stream corrupted"; closeConnection(); return false; } @@ -529,7 +529,7 @@ namespace // all sync functions should already have sent response std::stringstream ss; ss << "API sync method has not called SendAPIResponse, request: " << data; - LOG_ERROR() << ss.str(); + BEAM_LOG_ERROR() << ss.str(); closeConnection(); throw std::runtime_error(ss.str()); @@ -567,7 +567,7 @@ namespace if (!result) ok = false; } else { - LOG_ERROR() << "cannot create response"; + BEAM_LOG_ERROR() << "cannot create response"; } _headers.clear(); @@ -742,8 +742,8 @@ int main(int argc, char* argv[]) auto cfgApi = ReadCfgFromFile(vm, desc); vm.notify(); - int logLevel = getLogLevel(cli::LOG_LEVEL, vm, LOG_LEVEL_DEBUG); - int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, LOG_LEVEL_DEBUG); + int logLevel = getLogLevel(cli::LOG_LEVEL, vm, BEAM_LOG_LEVEL_DEBUG); + int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, BEAM_LOG_LEVEL_DEBUG); const auto path = boost::filesystem::system_complete("./logs"); auto logger = beam::Logger::create(logLevel, logLevel, fileLogLevel, "api_", path.string()); @@ -751,12 +751,12 @@ int main(int argc, char* argv[]) // Since ReadCfg outputs file name to std::cout print also to logs if (cfgCommon) { - LOG_INFO() << "Wallet API common config read from: " << *cfgCommon; + BEAM_LOG_INFO() << "Wallet API common config read from: " << *cfgCommon; } if (cfgApi) { - LOG_INFO() << "Wallet API config read from: " << *cfgApi; + BEAM_LOG_INFO() << "Wallet API config read from: " << *cfgApi; } io::Address node_addr; @@ -773,14 +773,14 @@ int main(int argc, char* argv[]) getRulesOptions(vm); Rules::get().UpdateChecksum(); - LOG_INFO() << "Beam Wallet API " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Beam Wallet API " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); if (options.useAcl) { if (!(boost::filesystem::exists(options.aclPath) && (acl = loadACL(options.aclPath)))) { - LOG_ERROR() << "ACL file not loaded, path is: " << options.aclPath; + BEAM_LOG_ERROR() << "ACL file not loaded, path is: " << options.aclPath; return -1; } } @@ -790,14 +790,14 @@ int main(int argc, char* argv[]) const auto& certPath = connectionOptions.tls.certPath; if (certPath.empty() || !boost::filesystem::exists(certPath)) { - LOG_ERROR() << "TLS certificate not found, path is: " << certPath; + BEAM_LOG_ERROR() << "TLS certificate not found, path is: " << certPath; return -1; } const auto& keyPath = connectionOptions.tls.keyPath; if (keyPath.empty() || !boost::filesystem::exists(keyPath)) { - LOG_ERROR() << "TLS private key not found, path is: " << keyPath; + BEAM_LOG_ERROR() << "TLS private key not found, path is: " << keyPath; return -1; } } @@ -816,7 +816,7 @@ int main(int argc, char* argv[]) } else { - LOG_ERROR() << "IP address not added to whitelist: " << item; + BEAM_LOG_ERROR() << "IP address not added to whitelist: " << item; return -1; } } @@ -824,31 +824,31 @@ int main(int argc, char* argv[]) if (vm.count(cli::NODE_ADDR) == 0) { - LOG_ERROR() << "node address should be specified"; + BEAM_LOG_ERROR() << "node address should be specified"; return -1; } if (!node_addr.resolve(options.nodeURI.c_str())) { - LOG_ERROR() << "unable to resolve node address: " << options.nodeURI; + BEAM_LOG_ERROR() << "unable to resolve node address: " << options.nodeURI; return -1; } if (!WalletDB::isInitialized(options.walletPath)) { - LOG_ERROR() << "Wallet not found, path is: " << options.walletPath; + BEAM_LOG_ERROR() << "Wallet not found, path is: " << options.walletPath; return -1; } SecString pass; if (!beam::read_wallet_pass(pass, vm)) { - LOG_ERROR() << "Please, provide password for the wallet."; + BEAM_LOG_ERROR() << "Please, provide password for the wallet."; return -1; } walletDB = WalletDB::open(options.walletPath, pass); - LOG_INFO() << "wallet successfully opened..."; + BEAM_LOG_INFO() << "wallet successfully opened..."; // this should be exactly CLI flag value to print correct error messages // Rules::CA.Enabled would be checked as well but later @@ -870,18 +870,18 @@ int main(int argc, char* argv[]) if (nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << "Node poll period = " << nnet->m_Cfg.m_PollPeriod_ms << " ms"; + BEAM_LOG_INFO() << "Node poll period = " << nnet->m_Cfg.m_PollPeriod_ms << " ms"; uint32_t timeout_ms = std::max(Rules::get().DA.Target_s * 1000, nnet->m_Cfg.m_PollPeriod_ms); if (timeout_ms != nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << "Node poll period has been automatically rounded up to block rate: " << timeout_ms << " ms"; + BEAM_LOG_INFO() << "Node poll period has been automatically rounded up to block rate: " << timeout_ms << " ms"; } } uint32_t responseTime_s = Rules::get().DA.Target_s * wallet::kDefaultTxResponseTime; if (nnet->m_Cfg.m_PollPeriod_ms >= responseTime_s * 1000) { - LOG_WARNING() << "The \"--node_poll_period\" parameter set to more than " + BEAM_LOG_WARNING() << "The \"--node_poll_period\" parameter set to more than " << uint32_t(responseTime_s / 3600) << " hours may cause transaction problems."; } @@ -914,7 +914,7 @@ int main(int argc, char* argv[]) } else { - LOG_INFO() << "IPFS is not enabled. IPFS node will be not started."; + BEAM_LOG_INFO() << "IPFS is not enabled. IPFS node will be not started."; } #endif @@ -947,7 +947,7 @@ int main(int argc, char* argv[]) } } #endif - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } // DO NOT USE LOG_ below. Logger is dead here catch (const DatabaseException& e) diff --git a/wallet/api/cli/api_server.h b/wallet/api/cli/api_server.h index 1c8a06a12..0d988b165 100644 --- a/wallet/api/cli/api_server.h +++ b/wallet/api/cli/api_server.h @@ -58,7 +58,7 @@ namespace beam if (!parsed) { - LOG_ERROR() << "ACL parsing error, line " << curLine; + BEAM_LOG_ERROR() << "ACL parsing error, line " << curLine; return boost::none; } @@ -68,11 +68,11 @@ namespace beam if (keys.empty()) { - LOG_WARNING() << "ACL file is empty"; + BEAM_LOG_WARNING() << "ACL file is empty"; } else { - LOG_INFO() << "ACL file successfully loaded"; + BEAM_LOG_INFO() << "ACL file successfully loaded"; } return wallet::ApiACL(keys); @@ -135,7 +135,7 @@ namespace beam protected: void start() { - LOG_INFO() << "Start server on " << _bindAddress; + BEAM_LOG_INFO() << "Start server on " << _bindAddress; try { @@ -147,7 +147,7 @@ namespace beam } catch (const std::exception& e) { - LOG_ERROR() << "cannot start server: " << e.what(); + BEAM_LOG_ERROR() << "cannot start server: " << e.what(); } } @@ -191,7 +191,7 @@ namespace beam { if (std::find(_whitelist.begin(), _whitelist.end(), peer.ip()) == _whitelist.end()) { - LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; + BEAM_LOG_WARNING() << peer.str() << " not in IP whitelist, closing"; return; } } @@ -244,14 +244,14 @@ namespace beam { if (errorCode != 0) { - LOG_INFO() << "peer disconnected, code=" << io::error_str(errorCode); + BEAM_LOG_INFO() << "peer disconnected, code=" << io::error_str(errorCode); _server.closeConnection(_stream->peer_address().u64()); return false; } if (!_lineProtocol.new_data_from_stream(data, size)) { - LOG_INFO() << "stream corrupted"; + BEAM_LOG_INFO() << "stream corrupted"; _server.closeConnection(_stream->peer_address().u64()); return false; } @@ -363,7 +363,7 @@ namespace beam if (!result) ok = false; } else { - LOG_ERROR() << "cannot create response"; + BEAM_LOG_ERROR() << "cannot create response"; } _headers.clear(); diff --git a/wallet/api/i_wallet_api.cpp b/wallet/api/i_wallet_api.cpp index 398d004b4..bbef980d9 100644 --- a/wallet/api/i_wallet_api.cpp +++ b/wallet/api/i_wallet_api.cpp @@ -60,7 +60,7 @@ namespace beam::wallet } catch(std::exception& ex) { - LOG_WARNING() << "ValidateAPIVersion: " << ex.what(); + BEAM_LOG_WARNING() << "ValidateAPIVersion: " << ex.what(); return false; } } diff --git a/wallet/api/v6_0/v6_api_handle.cpp b/wallet/api/v6_0/v6_api_handle.cpp index 1b80a86a7..e8e80d17b 100644 --- a/wallet/api/v6_0/v6_api_handle.cpp +++ b/wallet/api/v6_0/v6_api_handle.cpp @@ -828,7 +828,7 @@ namespace beam::wallet void V6Api::onHandleInvokeContract(const JsonRpcId &id, InvokeContract&& data) { - LOG_VERBOSE() << "InvokeContract(id = " << id << ")"; + BEAM_LOG_VERBOSE() << "InvokeContract(id = " << id << ")"; auto contracts = getContracts(); if (!contracts->IsDone()) @@ -853,7 +853,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } @@ -883,7 +883,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } @@ -914,7 +914,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } @@ -950,7 +950,7 @@ namespace beam::wallet auto guard = _guard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before fly client response received."; + BEAM_LOG_WARNING() << "API destroyed before fly client response received."; return; } diff --git a/wallet/api/v6_0/v6_api_parse.cpp b/wallet/api/v6_0/v6_api_parse.cpp index d5165c542..a577b22f3 100644 --- a/wallet/api/v6_0/v6_api_parse.cpp +++ b/wallet/api/v6_0/v6_api_parse.cpp @@ -919,17 +919,17 @@ namespace beam::wallet throw jsonrpc_exception(ApiError::InvalidParamsJsonRpc, "Failed to parse invoke data"); } - LOG_INFO() << "onParseProcessInvokeData"; + BEAM_LOG_INFO() << "onParseProcessInvokeData"; for (const auto& entry: realData.m_vec) { - LOG_INFO() << "\tCid: " << entry.m_Cid; - LOG_INFO() << "\tMethod: " << entry.m_iMethod; - LOG_INFO() << "\tCharge: " << entry.m_Charge; - LOG_INFO() << "\tComment: " << entry.m_sComment; + BEAM_LOG_INFO() << "\tCid: " << entry.m_Cid; + BEAM_LOG_INFO() << "\tMethod: " << entry.m_iMethod; + BEAM_LOG_INFO() << "\tCharge: " << entry.m_Charge; + BEAM_LOG_INFO() << "\tComment: " << entry.m_sComment; for (const auto& spend: entry.m_Spend) { - LOG_INFO() << "\t (aid, amount): (" << spend.first << ", " << spend.second << ")"; + BEAM_LOG_INFO() << "\t (aid, amount): (" << spend.first << ", " << spend.second << ")"; } } diff --git a/wallet/api/v6_1/v6_1_api_handle.cpp b/wallet/api/v6_1/v6_1_api_handle.cpp index 7484fd52d..89c4b0d82 100644 --- a/wallet/api/v6_1/v6_1_api_handle.cpp +++ b/wallet/api/v6_1/v6_1_api_handle.cpp @@ -194,7 +194,7 @@ namespace beam::wallet void V61Api::onHandleInvokeContractV61(const JsonRpcId &id, InvokeContractV61&& data) { - LOG_VERBOSE() << "InvokeContract(id = " << id << ")"; + BEAM_LOG_VERBOSE() << "InvokeContract(id = " << id << ")"; auto contracts = getContracts(); if (data.createTx) @@ -214,7 +214,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } @@ -244,7 +244,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } diff --git a/wallet/api/v6_1/v6_1_api_notify.cpp b/wallet/api/v6_1/v6_1_api_notify.cpp index cdcb17d17..c1067b9f6 100644 --- a/wallet/api/v6_1/v6_1_api_notify.cpp +++ b/wallet/api/v6_1/v6_1_api_notify.cpp @@ -72,7 +72,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onSyncProgress failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onSyncProgress failed: " << e.what(); } } @@ -103,7 +103,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onSystemStateChanged failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onSystemStateChanged failed: " << e.what(); } } @@ -171,7 +171,7 @@ namespace beam::wallet } else { - LOG_WARNING() << "onAssetsChanged: failed to find asset " << aid << ", action" << std::to_string(action); + BEAM_LOG_WARNING() << "onAssetsChanged: failed to find asset " << aid << ", action" << std::to_string(action); } } } @@ -185,7 +185,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onAssetsChanged failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onAssetsChanged failed: " << e.what(); } } @@ -204,7 +204,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onAssetChanged failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onAssetChanged failed: " << e.what(); } } @@ -261,7 +261,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onCoinsChangedImp failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onCoinsChangedImp failed: " << e.what(); } } @@ -327,7 +327,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onAddressChanged failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onAddressChanged failed: " << e.what(); } } @@ -382,7 +382,7 @@ namespace beam::wallet } catch(std::exception& e) { - LOG_ERROR() << "V61Api::onTransactionChanged failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::onTransactionChanged failed: " << e.what(); } } @@ -409,7 +409,7 @@ namespace beam::wallet } catch (std::exception& e) { - LOG_ERROR() << "V61Api::sendConnectionStatus failed: " << e.what(); + BEAM_LOG_ERROR() << "V61Api::sendConnectionStatus failed: " << e.what(); } } diff --git a/wallet/api/v7_0/v7_0_api_handle.cpp b/wallet/api/v7_0/v7_0_api_handle.cpp index 72f92ec74..3d2597219 100644 --- a/wallet/api/v7_0/v7_0_api_handle.cpp +++ b/wallet/api/v7_0/v7_0_api_handle.cpp @@ -26,7 +26,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -37,7 +37,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -58,7 +58,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -69,7 +69,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -90,7 +90,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -101,7 +101,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -122,7 +122,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -133,7 +133,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } sendError(id, ApiError::IPFSError, err); @@ -153,7 +153,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -164,7 +164,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } sendError(id, ApiError::IPFSError, err); @@ -184,7 +184,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } @@ -195,7 +195,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before IPFS response received."; + BEAM_LOG_WARNING() << "API destroyed before IPFS response received."; return; } sendError(id, ApiError::IPFSError, err); diff --git a/wallet/api/v7_3/v7_3_api_handle.cpp b/wallet/api/v7_3/v7_3_api_handle.cpp index faf5c11a6..009bfc935 100644 --- a/wallet/api/v7_3/v7_3_api_handle.cpp +++ b/wallet/api/v7_3/v7_3_api_handle.cpp @@ -33,7 +33,7 @@ namespace beam::wallet auto guard = wguard.lock(); if (!guard) { - LOG_WARNING() << "API destroyed before shader response received."; + BEAM_LOG_WARNING() << "API destroyed before shader response received."; return; } Height refreshHeight = h; diff --git a/wallet/broadcaster/broadcaster.cpp b/wallet/broadcaster/broadcaster.cpp index bde2a746b..7165c6819 100644 --- a/wallet/broadcaster/broadcaster.cpp +++ b/wallet/broadcaster/broadcaster.cpp @@ -214,7 +214,7 @@ namespace using proto::FlyClient::NetworkStd::NetworkStd; void OnConnectionFailed(const proto::NodeConnection::DisconnectReason& reason) override { - LOG_ERROR() << kErrorConnectionFailed << ", reason: " << reason; + BEAM_LOG_ERROR() << kErrorConnectionFailed << ", reason: " << reason; }; }; @@ -289,11 +289,11 @@ namespace ECC::Scalar::Native sk; PeerID pk; - LOG_INFO() << "Key generation requested"; + BEAM_LOG_INFO() << "Key generation requested"; if (!generateKeyPair(sk, pk)) { - LOG_ERROR() << "key generation error"; + BEAM_LOG_ERROR() << "key generation error"; return -1; } @@ -302,7 +302,7 @@ namespace std::cout << "Private key: " << skToPrint.str() << std::endl; std::cout << "Public key: " << pk.str() << std::endl; - LOG_INFO() << "Key pair successfully generated"; + BEAM_LOG_INFO() << "Key pair successfully generated"; boost::filesystem::remove(std::string(TEMP_DB_FILE_NAME)); return 0; @@ -310,30 +310,30 @@ namespace int transmitCommand(const po::variables_map& vm, const Options& options) { - LOG_INFO() << "Message transmit requested"; + BEAM_LOG_INFO() << "Message transmit requested"; if (vm.count(cli::NODE_ADDR) == 0) { - LOG_ERROR() << "node address should be specified"; + BEAM_LOG_ERROR() << "node address should be specified"; return -1; } if (vm.count(cli::MESSAGE_TYPE) == 0) { - LOG_ERROR() << "message type has to be specified"; + BEAM_LOG_ERROR() << "message type has to be specified"; return -1; } if (vm.count(cli::PRIVATE_KEY) == 0) { - LOG_ERROR() << "private key has to be specified"; + BEAM_LOG_ERROR() << "private key has to be specified"; return -1; } io::Address nodeAddress; if (!nodeAddress.resolve(options.nodeURI.c_str())) { - LOG_ERROR() << "unable to resolve node address: " << options.nodeURI; + BEAM_LOG_ERROR() << "unable to resolve node address: " << options.nodeURI; return -1; } @@ -344,17 +344,17 @@ namespace if (nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << "Node poll period = " << nnet->m_Cfg.m_PollPeriod_ms << " ms"; + BEAM_LOG_INFO() << "Node poll period = " << nnet->m_Cfg.m_PollPeriod_ms << " ms"; uint32_t timeout_ms = std::max(Rules::get().DA.Target_s * 1000, nnet->m_Cfg.m_PollPeriod_ms); if (timeout_ms != nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << "Node poll period has been automatically rounded up to block rate: " << timeout_ms << " ms"; + BEAM_LOG_INFO() << "Node poll period has been automatically rounded up to block rate: " << timeout_ms << " ms"; } } uint32_t responceTime_s = Rules::get().DA.Target_s * wallet::kDefaultTxResponseTime; if (nnet->m_Cfg.m_PollPeriod_ms >= responceTime_s * 1000) { - LOG_WARNING() << "The \"--node_poll_period\" parameter set to more than " << uint32_t(responceTime_s / 3600) << " hours may cause transaction problems."; + BEAM_LOG_WARNING() << "The \"--node_poll_period\" parameter set to more than " << uint32_t(responceTime_s / 3600) << " hours may cause transaction problems."; } nnet->m_Cfg.m_vNodes.push_back(nodeAddress); nnet->Connect(); @@ -367,7 +367,7 @@ namespace ECC::Scalar::Native key; if (!BroadcastMsgCreator::stringToPrivateKey(options.privateKey, key)) { - LOG_ERROR() << "Invalid private key."; + BEAM_LOG_ERROR() << "Invalid private key."; return -1; } @@ -397,7 +397,7 @@ namespace } else { - LOG_ERROR() << "Invalid type of message: " << options.messageType; + BEAM_LOG_ERROR() << "Invalid type of message: " << options.messageType; return -1; } @@ -421,7 +421,7 @@ namespace } else { - LOG_ERROR() << "Invalid message parameters"; + BEAM_LOG_ERROR() << "Invalid message parameters"; return -1; } @@ -436,7 +436,7 @@ int main(int argc, char* argv[]) namespace po = boost::program_options; const auto path = boost::filesystem::system_complete("./logs"); - auto logger = beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, "broadcast_", path.string()); + auto logger = beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG, "broadcast_", path.string()); try { @@ -501,8 +501,8 @@ int main(int argc, char* argv[]) LogRotation logRotation(*reactor, LOG_ROTATION_PERIOD_SEC, options.logCleanupPeriod); Rules::get().UpdateChecksum(); - LOG_INFO() << "Broadcasting utility " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Broadcasting utility " << PROJECT_VERSION << " (" << BRANCH_NAME << ")"; + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); if (vm.count(cli::COMMAND) == 0) { @@ -522,20 +522,20 @@ int main(int argc, char* argv[]) } else { - LOG_ERROR() << "unknown command: " << command; + BEAM_LOG_ERROR() << "unknown command: " << command; return -1; } } - LOG_INFO() << "Done"; + BEAM_LOG_INFO() << "Done"; } catch (const std::exception& e) { - LOG_ERROR() << "EXCEPTION: " << e.what(); + BEAM_LOG_ERROR() << "EXCEPTION: " << e.what(); } catch (...) { - LOG_ERROR() << "NON_STD EXCEPTION"; + BEAM_LOG_ERROR() << "NON_STD EXCEPTION"; } return 0; diff --git a/wallet/cli/cli.cpp b/wallet/cli/cli.cpp index 598270224..9674444cf 100644 --- a/wallet/cli/cli.cpp +++ b/wallet/cli/cli.cpp @@ -150,7 +150,7 @@ namespace auto tx = walletDB->getTx(txID); if (!tx) { - LOG_WARNING() << "Can't get transaction details"; + BEAM_LOG_WARNING() << "Can't get transaction details"; return ""; } const TxDescription& desc = *tx; @@ -294,7 +294,7 @@ namespace IWalletDB::Ptr walletDB = WalletDB::open(walletPath, pass); - LOG_INFO() << kWalletOpenedMessage; + BEAM_LOG_INFO() << kWalletOpenedMessage; return walletDB; } @@ -621,7 +621,7 @@ namespace } else { - LOG_ERROR() << boost::format(kErrorAddrExprTimeInvalid) + BEAM_LOG_ERROR() << boost::format(kErrorAddrExprTimeInvalid) % cli::EXPIRATION_TIME % expiration; return -1; @@ -727,18 +727,18 @@ namespace } else { - LOG_ERROR() << kErrorWalletAlreadyInitialized; + BEAM_LOG_ERROR() << kErrorWalletAlreadyInitialized; return -1; } } - LOG_INFO() << kStartMessage; + BEAM_LOG_INFO() << kStartMessage; SecString pass = GetPassword(vm); if (vm.count(cli::PASS) == 0 && !beam::confirm_wallet_pass(pass)) { - LOG_ERROR() << kErrorWalletPwdNotMatch; + BEAM_LOG_ERROR() << kErrorWalletPwdNotMatch; return -1; } @@ -752,7 +752,7 @@ namespace walletSeed.V = Zero; if (!ReadWalletSeed(walletSeed, vm, InitKind::GenerateSeed == kind)) { - LOG_ERROR() << kErrorSeedPhraseFail; + BEAM_LOG_ERROR() << kErrorSeedPhraseFail; return -1; } @@ -762,11 +762,11 @@ namespace if (walletDB) { - LOG_INFO() << kWalletCreatedMessage; + BEAM_LOG_INFO() << kWalletCreatedMessage; walletDB->generateAndSaveDefaultAddress(); return 0; } - LOG_ERROR() << kErrorWalletNotCreated; + BEAM_LOG_ERROR() << kErrorWalletNotCreated; return -1; } @@ -911,7 +911,7 @@ namespace WordList phrase; if (generateNew) { - LOG_INFO() << kSeedPhraseReadTitle; + BEAM_LOG_INFO() << kSeedPhraseReadTitle; phrase = GeneratePhrase(); } else if (vm.count(cli::SEED_PHRASE)) @@ -923,13 +923,13 @@ namespace if (phrase.size() != WORD_COUNT || (vm.count(cli::IGNORE_DICTIONARY) == 0 && !isValidMnemonic(phrase))) { - LOG_ERROR() << boost::format(kErrorSeedPhraseInvalid) % tempPhrase; + BEAM_LOG_ERROR() << boost::format(kErrorSeedPhraseInvalid) % tempPhrase; return false; } } else { - LOG_ERROR() << kErrorSeedPhraseNotProvided; + BEAM_LOG_ERROR() << kErrorSeedPhraseNotProvided; return false; } @@ -1751,7 +1751,7 @@ namespace auto txIdStr = vm[cli::TX_ID].as(); if (txIdStr.empty()) { - LOG_ERROR() << kErrorTxIdParamReqired; + BEAM_LOG_ERROR() << kErrorTxIdParamReqired; return res; } @@ -1764,7 +1764,7 @@ namespace } else { - LOG_ERROR() << boost::format(kErrorTxIdParamInvalid) % txIdStr; + BEAM_LOG_ERROR() << boost::format(kErrorTxIdParamInvalid) % txIdStr; } return res; } @@ -1780,7 +1780,7 @@ namespace auto tx = walletDB->getTx(*txId); if (!tx) { - LOG_ERROR() << boost::format(kErrorTxWithIdNotFound) % vm[cli::TX_ID].as(); + BEAM_LOG_ERROR() << boost::format(kErrorTxWithIdNotFound) % vm[cli::TX_ID].as(); return -1; } @@ -1819,17 +1819,17 @@ namespace auto tx = walletDB->getTx(*txId); if (!tx) { - LOG_ERROR() << kErrorPpExportFailed; + BEAM_LOG_ERROR() << kErrorPpExportFailed; return -1; } if (!tx->m_sender || tx->m_selfTx) { - LOG_ERROR() << kErrorPpCannotExportForReceiver; + BEAM_LOG_ERROR() << kErrorPpCannotExportForReceiver; return -1; } if (tx->m_status != TxStatus::Completed) { - LOG_ERROR() << kErrorPpExportFailedTxNotCompleted; + BEAM_LOG_ERROR() << kErrorPpExportFailedTxNotCompleted; return -1; } @@ -1864,7 +1864,7 @@ namespace } catch (const std::runtime_error & e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); throw std::runtime_error(kErrorPpInvalid); } @@ -1944,11 +1944,11 @@ namespace FStream f; if (f.Open(timestampedPath.c_str(), false) && f.write(data.data(), data.size()) == data.size()) { - LOG_INFO() << kDataExportedMessage; + BEAM_LOG_INFO() << kDataExportedMessage; return true; } - LOG_ERROR() << kErrorExportDataFail; + BEAM_LOG_ERROR() << kErrorExportDataFail; return false; } @@ -1964,14 +1964,14 @@ namespace ByteBuffer buffer; if (vm[cli::IMPORT_EXPORT_PATH].defaulted()) { - LOG_ERROR() << kErrorFileLocationParamReqired; + BEAM_LOG_ERROR() << kErrorFileLocationParamReqired; return -1; } auto path = vm[cli::IMPORT_EXPORT_PATH].as(); if (path.empty() || !LoadDataToImport(path, buffer)) { - LOG_ERROR() << boost::format(kErrorImportPathInvalid) + BEAM_LOG_ERROR() << boost::format(kErrorImportPathInvalid) % path; return -1; } @@ -2009,7 +2009,7 @@ namespace explicit CliNodeConnection(proto::FlyClient& fc) : proto::FlyClient::NetworkStd(fc) {}; void OnConnectionFailed(const proto::NodeConnection::DisconnectReason& reason) override { - LOG_ERROR() << kErrorConnectionFailed << " reason: " << reason; + BEAM_LOG_ERROR() << kErrorConnectionFailed << " reason: " << reason; }; }; @@ -2018,7 +2018,7 @@ namespace { if (vm.count(cli::NODE_ADDR) == 0) { - LOG_ERROR() << kErrorNodeAddrNotSpecified; + BEAM_LOG_ERROR() << kErrorNodeAddrNotSpecified; return nullptr; } @@ -2026,7 +2026,7 @@ namespace io::Address nodeAddress; if (!nodeAddress.resolve(nodeURI.c_str())) { - LOG_ERROR() << boost::format(kErrorNodeAddrUnresolved) % nodeURI; + BEAM_LOG_ERROR() << boost::format(kErrorNodeAddrUnresolved) % nodeURI; return nullptr; } @@ -2035,14 +2035,14 @@ namespace vm[cli::NODE_POLL_PERIOD].as>().value; if (nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << boost::format(kNodePoolPeriod) + BEAM_LOG_INFO() << boost::format(kNodePoolPeriod) % nnet->m_Cfg.m_PollPeriod_ms; uint32_t timeout_ms = std::max(Rules::get().DA.Target_s * 1000, nnet->m_Cfg.m_PollPeriod_ms); if (timeout_ms != nnet->m_Cfg.m_PollPeriod_ms) { - LOG_INFO() << boost::format(kNodePoolPeriodRounded) + BEAM_LOG_INFO() << boost::format(kNodePoolPeriodRounded) % timeout_ms; } } @@ -2054,7 +2054,7 @@ namespace Rules::get().DA.Target_s * wallet::kDefaultTxResponseTime; if (nnet->m_Cfg.m_PollPeriod_ms >= responceTime_s * 1000) { - LOG_WARNING() << boost::format(kErrorNodePoolPeriodTooMuch) + BEAM_LOG_WARNING() << boost::format(kErrorNodePoolPeriodTooMuch) % uint32_t(responceTime_s / 3600); } nnet->m_Cfg.m_vNodes.push_back(nodeAddress); @@ -2065,7 +2065,7 @@ namespace io::Address proxyAddr; if (!proxyAddr.resolve(proxyURI.c_str())) { - LOG_ERROR() << boost::format(kErrorNodeAddrUnresolved) % proxyURI; + BEAM_LOG_ERROR() << boost::format(kErrorNodeAddrUnresolved) % proxyURI; return nullptr; } nnet->m_Cfg.m_ProxyAddr = proxyAddr; @@ -2308,7 +2308,7 @@ namespace #endif // BEAM_ASSET_SWAP_SUPPORT ) { - LOG_INFO() << kStartMessage; + BEAM_LOG_INFO() << kStartMessage; auto walletDB = OpenDataBase(vm); bool isServer = vm[cli::COMMAND].as() == cli::LISTEN || vm.count(cli::LISTEN); @@ -2669,17 +2669,17 @@ namespace auto tx = walletDB->getTx(*txId); if (tx) { - LOG_INFO() << "deleting tx " << *txId; + BEAM_LOG_INFO() << "deleting tx " << *txId; if (tx->canDelete()) { walletDB->deleteTx(*txId); return 0; } - LOG_ERROR() << kErrorTxStatusInvalid; + BEAM_LOG_ERROR() << kErrorTxStatusInvalid; return -1; } - LOG_ERROR() << kErrorTxIdUnknown; + BEAM_LOG_ERROR() << kErrorTxIdUnknown; return -1; } @@ -2702,10 +2702,10 @@ namespace wallet->CancelTransaction(*txId); return 0; } - LOG_ERROR() << kErrorCancelTxInInvalidStatus << interpretStatusCliImpl(*tx); + BEAM_LOG_ERROR() << kErrorCancelTxInInvalidStatus << interpretStatusCliImpl(*tx); return -1; } - LOG_ERROR() << kErrorTxIdUnknown; + BEAM_LOG_ERROR() << kErrorTxIdUnknown; return -1; }); } @@ -2751,14 +2751,14 @@ namespace auto walletDB = OpenDataBase(vm); if (HasActiveSwapTx(walletDB, swapCoin)) { - LOG_ERROR() << "You cannot change settings while you have transactions in progress. Please wait untill transactions are completed and try again."; + BEAM_LOG_ERROR() << "You cannot change settings while you have transactions in progress. Please wait untill transactions are completed and try again."; return -1; } return SetSwapSettings(vm, walletDB, swapCoin); } - LOG_ERROR() << "swap_coin should be specified"; + BEAM_LOG_ERROR() << "swap_coin should be specified"; return -1; } @@ -2773,7 +2773,7 @@ namespace return 0; } - LOG_ERROR() << "swap_coin should be specified"; + BEAM_LOG_ERROR() << "swap_coin should be specified"; return -1; } @@ -2789,7 +2789,7 @@ namespace return 0; } - LOG_ERROR() << "swap_coin should be specified"; + BEAM_LOG_ERROR() << "swap_coin should be specified"; return -1; } @@ -2805,7 +2805,7 @@ namespace return 0; } - LOG_ERROR() << "swap_coin should be specified"; + BEAM_LOG_ERROR() << "swap_coin should be specified"; return -1; } #endif // BEAM_ATOMIC_SWAP_SUPPORT @@ -2871,7 +2871,7 @@ namespace if (vm.count(cli::BLOCK_HEIGHT) != 1) { - LOG_ERROR() << "block_height should be specified"; + BEAM_LOG_ERROR() << "block_height should be specified"; return -1; } @@ -2879,7 +2879,7 @@ namespace if (!blockHeight) { - LOG_ERROR() << "Cannot get block header."; + BEAM_LOG_ERROR() << "Cannot get block header."; return -1; } @@ -2911,7 +2911,7 @@ namespace if (request.m_pTrg || request.m_vStates.size() != 1) { - LOG_ERROR() << "Cannot get block header."; + BEAM_LOG_ERROR() << "Cannot get block header."; return -1; } @@ -2950,7 +2950,7 @@ namespace { if (vm[cli::IMPORT_EXPORT_PATH].defaulted()) { - LOG_ERROR() << kErrorFileLocationParamReqired; + BEAM_LOG_ERROR() << kErrorFileLocationParamReqired; return -1; } @@ -3424,8 +3424,8 @@ int main(int argc, char* argv[]) return 0; } - int logLevel = getLogLevel(cli::LOG_LEVEL, vm, LOG_LEVEL_INFO); - int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, LOG_LEVEL_DEBUG); + int logLevel = getLogLevel(cli::LOG_LEVEL, vm, BEAM_LOG_LEVEL_INFO); + int fileLogLevel = getLogLevel(cli::FILE_LOG_LEVEL, vm, BEAM_LOG_LEVEL_DEBUG); #define LOG_FILES_DIR "logs" #define LOG_FILES_PREFIX "wallet_" @@ -3452,7 +3452,7 @@ int main(int argc, char* argv[]) if (vm.count(cli::COMMAND) == 0) { - LOG_ERROR() << kErrorCommandNotSpecified; + BEAM_LOG_ERROR() << kErrorCommandNotSpecified; printHelp(begin(commands), end(commands), visibleOptions); return 0; } @@ -3462,12 +3462,12 @@ int main(int argc, char* argv[]) auto cit = find_if(begin(commands), end(commands), [&command](const auto& p) {return p.name == command; }); if (cit == end(commands)) { - LOG_ERROR() << boost::format(kErrorCommandUnknown) % command; + BEAM_LOG_ERROR() << boost::format(kErrorCommandUnknown) % command; return -1; } - LOG_INFO() << boost::format(kVersionInfo) % PROJECT_VERSION % BRANCH_NAME; - LOG_INFO() << boost::format(kRulesSignatureInfo) % Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << boost::format(kVersionInfo) % PROJECT_VERSION % BRANCH_NAME; + BEAM_LOG_INFO() << boost::format(kRulesSignatureInfo) % Rules::get().get_SignatureStr(); return cit->handler(vm); } @@ -3480,12 +3480,12 @@ int main(int argc, char* argv[]) } catch (const FileIsNotDatabaseException&) { - LOG_ERROR() << kErrorCantOpenWallet; + BEAM_LOG_ERROR() << kErrorCantOpenWallet; return -1; } catch (const DatabaseException & ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); return -1; } catch (const po::invalid_option_value& e) @@ -3505,12 +3505,12 @@ int main(int argc, char* argv[]) } catch (const po::error& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); printHelp(begin(commands), end(commands), visibleOptions); } catch (const std::runtime_error& e) { - LOG_ERROR() << e.what(); + BEAM_LOG_ERROR() << e.what(); } } catch (const std::exception& e) diff --git a/wallet/cli/laser.cpp b/wallet/cli/laser.cpp index 9278dbae9..62745e29c 100644 --- a/wallet/cli/laser.cpp +++ b/wallet/cli/laser.cpp @@ -35,7 +35,7 @@ void LaserObserver::OnOpened(const laser::ChannelIDPtr& chID) } else if (m_vm.count(cli::LASER_WAIT)) { - LOG_INFO() << boost::format(kLaserMessageChannelServed) + BEAM_LOG_INFO() << boost::format(kLaserMessageChannelServed) % to_hex(chID->m_pData, chID->nBytes); } LaserShow(m_walletDB); @@ -43,7 +43,7 @@ void LaserObserver::OnOpened(const laser::ChannelIDPtr& chID) void LaserObserver::OnOpenFailed(const laser::ChannelIDPtr& chID) { - LOG_ERROR() << boost::format(kLaserErrorOpenFailed) + BEAM_LOG_ERROR() << boost::format(kLaserErrorOpenFailed) % to_hex(chID->m_pData, chID->nBytes); io::Reactor::get_Current().stop(); } @@ -54,7 +54,7 @@ void LaserObserver::OnClosed(const laser::ChannelIDPtr& chID) { io::Reactor::get_Current().stop(); } - LOG_INFO() << boost::format(kLaserMessageClosed) + BEAM_LOG_INFO() << boost::format(kLaserMessageClosed) % to_hex(chID->m_pData, chID->nBytes); LaserShow(m_walletDB); } @@ -65,7 +65,7 @@ void LaserObserver::OnCloseFailed(const laser::ChannelIDPtr& chID) { io::Reactor::get_Current().stop(); } - LOG_ERROR() << boost::format(kLaserMessageCloseFailed) + BEAM_LOG_ERROR() << boost::format(kLaserMessageCloseFailed) % to_hex(chID->m_pData, chID->nBytes); } @@ -79,13 +79,13 @@ void LaserObserver::OnUpdateFinished(const laser::ChannelIDPtr& chID) { io::Reactor::get_Current().stop(); } - LOG_INFO() << boost::format(kLaserMessageUpdateFinished) + BEAM_LOG_INFO() << boost::format(kLaserMessageUpdateFinished) % to_hex(chID->m_pData, chID->nBytes); } void LaserObserver::OnTransferFailed(const laser::ChannelIDPtr& chID) { - LOG_ERROR() << boost::format(kLaserErrorTransferFailed) + BEAM_LOG_ERROR() << boost::format(kLaserErrorTransferFailed) % to_hex(chID->m_pData, chID->nBytes); } @@ -95,7 +95,7 @@ void LaserObserver::OnExpired(const laser::ChannelIDPtr& chID) { io::Reactor::get_Current().stop(); } - LOG_INFO() << boost::format(kLaserMessageExpired) + BEAM_LOG_INFO() << boost::format(kLaserMessageExpired) % to_hex(chID->m_pData, chID->nBytes); LaserShow(m_walletDB); } @@ -111,7 +111,7 @@ bool LoadLaserParams(const po::variables_map& vm, laser::Mediator& mediator, { if (!vm.count(cli::LASER_TARGET_ADDR)) { - LOG_ERROR() << kErrorReceiverAddrMissing; + BEAM_LOG_ERROR() << kErrorReceiverAddrMissing; return false; } receiverWalletID->FromHex(vm[cli::LASER_TARGET_ADDR].as()); @@ -119,13 +119,13 @@ bool LoadLaserParams(const po::variables_map& vm, laser::Mediator& mediator, if (!vm.count(cli::LASER_AMOUNT_MY)) { - LOG_ERROR() << kLaserErrorMyAmountMissing; + BEAM_LOG_ERROR() << kLaserErrorMyAmountMissing; return false; } if (!vm.count(cli::LASER_AMOUNT_TARGET)) { - LOG_ERROR() << kLaserErrorTrgAmountMissing; + BEAM_LOG_ERROR() << kLaserErrorTrgAmountMissing; return false; } @@ -139,7 +139,7 @@ bool LoadLaserParams(const po::variables_map& vm, laser::Mediator& mediator, if (*aMy == 0 && *aTrg == 0) { - LOG_ERROR() << "My amount and Remote side amount are Zero"; + BEAM_LOG_ERROR() << "My amount and Remote side amount are Zero"; return false; } @@ -153,13 +153,13 @@ bool LoadLaserParams(const po::variables_map& vm, laser::Mediator& mediator, *fee = vm[cli::LASER_FEE].as>().value; if (*fee < feeMin) { - LOG_ERROR() << "Failed to initiate the operation. The minimum fee is " << feeMin << " groth."; + BEAM_LOG_ERROR() << "Failed to initiate the operation. The minimum fee is " << feeMin << " groth."; return false; } } else { - LOG_INFO() << "\"--" << cli::LASER_FEE << "\" param is not specified, using default fee = " << feeMin; + BEAM_LOG_INFO() << "\"--" << cli::LASER_FEE << "\" param is not specified, using default fee = " << feeMin; *fee = feeMin; } @@ -231,7 +231,7 @@ bool LaserOpen(const MediatorPtr& laser, if (!LoadLaserParams(vm, *laser, &aMy, &aTrg, &fee, &receiverWalletID)) { - LOG_ERROR() << kLaserErrorParamsRead; + BEAM_LOG_ERROR() << kLaserErrorParamsRead; return false; } @@ -248,7 +248,7 @@ bool LaserWait(const MediatorPtr& laser, if (!LoadLaserParams(vm, *laser, &aMy, &aTrg, &fee, &receiverWalletID, true)) { - LOG_ERROR() << kLaserErrorParamsRead; + BEAM_LOG_ERROR() << kLaserErrorParamsRead; return false; } @@ -267,7 +267,7 @@ bool LaserServe(const MediatorPtr& laser, if (channelIDs.empty()) { - LOG_ERROR() << "Channels not specified"; + BEAM_LOG_ERROR() << "Channels not specified"; return false; } @@ -277,7 +277,7 @@ bool LaserServe(const MediatorPtr& laser, if (laser->Serve(channelID)) ++count; } - LOG_INFO() << "Listen: " << count + BEAM_LOG_INFO() << "Listen: " << count << (count == 1 ? " channel" : " channels"); return count != 0; } @@ -287,7 +287,7 @@ bool LaserTransfer(const MediatorPtr& laser, { if (!vm.count(cli::LASER_CHANNEL_ID)) { - LOG_ERROR() << kLaserErrorChannelIdMissing; + BEAM_LOG_ERROR() << kLaserErrorChannelIdMissing; return false; } @@ -296,7 +296,7 @@ bool LaserTransfer(const MediatorPtr& laser, Amount amount = static_cast(std::round(myAmount)); if (!amount) { - LOG_ERROR() << kErrorZeroAmount; + BEAM_LOG_ERROR() << kErrorZeroAmount; return false; } @@ -310,7 +310,7 @@ void LaserShow(const IWalletDB::Ptr& walletDB) auto channels = walletDB->loadLaserChannels(); if (channels.empty()) { - LOG_INFO() << "You has no laser channels yet"; + BEAM_LOG_INFO() << "You has no laser channels yet"; return; } @@ -350,7 +350,7 @@ bool LaserDrop(const MediatorPtr& laser, if (channelIDs.empty()) { - LOG_ERROR() << "Channels not specified"; + BEAM_LOG_ERROR() << "Channels not specified"; return false; } @@ -360,7 +360,7 @@ bool LaserDrop(const MediatorPtr& laser, if (laser->Close(channelID)) ++count; } - LOG_INFO() << "Close sceduled for: " << count + BEAM_LOG_INFO() << "Close sceduled for: " << count << (count == 1 ? " channel" : " channels"); return count != 0; } @@ -373,7 +373,7 @@ bool LaserClose(const MediatorPtr& laser, if (channelIDs.empty()) { - LOG_ERROR() << "Channels not specified"; + BEAM_LOG_ERROR() << "Channels not specified"; return false; } @@ -383,7 +383,7 @@ bool LaserClose(const MediatorPtr& laser, if (laser->GracefulClose(channelID)) ++count; } - LOG_INFO() << "Close sceduled for: " << count + BEAM_LOG_INFO() << "Close sceduled for: " << count << (count == 1 ? " channel" : " channels"); return count != 0; } @@ -396,7 +396,7 @@ bool LaserDelete(const MediatorPtr& laser, if (channelIDs.empty()) { - LOG_ERROR() << "Channels not specified"; + BEAM_LOG_ERROR() << "Channels not specified"; return false; } @@ -406,7 +406,7 @@ bool LaserDelete(const MediatorPtr& laser, if (laser->Delete(channelID)) ++count; } - LOG_INFO() << "Deleted: " << count + BEAM_LOG_INFO() << "Deleted: " << count << (count == 1 ? " channel" : " channels"); return count != 0; } diff --git a/wallet/cli/swaps.cpp b/wallet/cli/swaps.cpp index ce393c604..c499147c5 100644 --- a/wallet/cli/swaps.cpp +++ b/wallet/cli/swaps.cpp @@ -198,7 +198,7 @@ bool ParseElectrumSettings(const po::variables_map& vm, Settings& settings) return a + kElectrumSeparateSymbol + b; }); - LOG_INFO() << "seed = " << strSeed; + BEAM_LOG_INFO() << "seed = " << strSeed; } settings.SetElectrumConnectionOptions(electrumSettings); @@ -318,7 +318,7 @@ int SetSwapSettings(const po::variables_map& vm, const IWalletDB::Ptr& walletDB) } } - LOG_ERROR() << "unknown parameter"; + BEAM_LOG_ERROR() << "unknown parameter"; return -1; } @@ -330,7 +330,7 @@ int SetSwapSettings(const po::variables_map& vm, const IWalletDB::Ptr& walletDB) if (!isChanged && !settings.IsInitialized()) { - LOG_INFO() << "settings should be specified."; + BEAM_LOG_INFO() << "settings should be specified."; return -1; } @@ -393,11 +393,11 @@ void ShowSwapSettings(const IWalletDB::Ptr& walletDB, AtomicSwapCoin swapCoin) } stream << "Active connection: " << bitcoin::to_string(settings.GetCurrentConnectionType()) << '\n'; - LOG_INFO() << stream.str(); + BEAM_LOG_INFO() << stream.str(); return; } - LOG_INFO() << GetCoinName(swapCoin) << " settings are not initialized."; + BEAM_LOG_INFO() << GetCoinName(swapCoin) << " settings are not initialized."; } int SetEthSettings(const po::variables_map& vm, const IWalletDB::Ptr& walletDB, wallet::AtomicSwapCoin swapCoin) @@ -449,7 +449,7 @@ int SetEthSettings(const po::variables_map& vm, const IWalletDB::Ptr& walletDB, if (!isChanged && !settings.IsInitialized()) { - LOG_INFO() << "settings should be specified."; + BEAM_LOG_INFO() << "settings should be specified."; return -1; } @@ -488,11 +488,11 @@ void ShowEthSettings(const IWalletDB::Ptr& walletDB) stream << "Account index: " << settings.m_accountIndex << '\n'; stream << "Should connect: " << settings.m_shouldConnect << '\n'; - LOG_INFO() << stream.str(); + BEAM_LOG_INFO() << stream.str(); return; } - LOG_INFO() << GetCoinName(AtomicSwapCoin::Ethereum) << " settings are not initialized."; + BEAM_LOG_INFO() << GetCoinName(AtomicSwapCoin::Ethereum) << " settings are not initialized."; } template @@ -976,7 +976,7 @@ boost::optional InitSwap(const po::variables_map& vm, const IWalletDB::Ptr const auto& readyForTokenizeTxParams = PrepareSwapTxParamsForTokenization(mirroredTxParams); auto swapTxToken = std::to_string(readyForTokenizeTxParams); - LOG_INFO() << "Swap token: " << swapTxToken; + BEAM_LOG_INFO() << "Swap token: " << swapTxToken; } return currentTxID; } @@ -1113,7 +1113,7 @@ boost::optional AcceptSwap(const po::variables_map& vm, const IWalletDB::P if (!isAccepted) { - LOG_INFO() << "Swap rejected!"; + BEAM_LOG_INFO() << "Swap rejected!"; return boost::none; } diff --git a/wallet/cli/utils.cpp b/wallet/cli/utils.cpp index fae03fb77..ee3b6193e 100644 --- a/wallet/cli/utils.cpp +++ b/wallet/cli/utils.cpp @@ -33,7 +33,7 @@ namespace beam::wallet { if (vm.count(cli::AMOUNT) == 0) { - LOG_ERROR() << kErrorAmountMissing; + BEAM_LOG_ERROR() << kErrorAmountMissing; return false; } @@ -46,13 +46,13 @@ namespace beam::wallet if (preciseAmount == 0) { - LOG_ERROR() << kErrorZeroAmount; + BEAM_LOG_ERROR() << kErrorZeroAmount; return false; } if (preciseAmount < 0) { - LOG_ERROR() << (boost::format(kErrorNegativeAmount) % strAmount).str(); + BEAM_LOG_ERROR() << (boost::format(kErrorNegativeAmount) % strAmount).str(); return false; } @@ -61,7 +61,7 @@ namespace beam::wallet { std::stringstream ssLimit; ssLimit << PrintableAmount(limit, true, assetId); - LOG_ERROR() << (boost::format(kErrorTooBigAmount) % strAmount % ssLimit.str()).str(); + BEAM_LOG_ERROR() << (boost::format(kErrorTooBigAmount) % strAmount % ssLimit.str()).str(); return false; } @@ -69,8 +69,8 @@ namespace beam::wallet } catch (const std::runtime_error& err) { - LOG_ERROR() << "the argument ('" << strAmount << "') for option '--amount' is invalid."; - LOG_ERROR() << err.what(); + BEAM_LOG_ERROR() << "the argument ('" << strAmount << "') for option '--amount' is invalid."; + BEAM_LOG_ERROR() << err.what(); return false; } @@ -91,7 +91,7 @@ namespace beam::wallet auto minFee = get_MinFee(wallet, hasShieldedOutputs); if (fee < minFee) { - LOG_ERROR() << (boost::format(kErrorFeeToLow) % minFee).str(); + BEAM_LOG_ERROR() << (boost::format(kErrorFeeToLow) % minFee).str(); return false; } } @@ -107,7 +107,7 @@ namespace beam::wallet { if (vm.find(cli::RECEIVER_ADDR) == vm.end()) { - LOG_ERROR() << kErrorReceiverAddrMissing; + BEAM_LOG_ERROR() << kErrorReceiverAddrMissing; return false; } @@ -116,7 +116,7 @@ namespace beam::wallet if (!receiverParams) { - LOG_ERROR() << kErrorReceiverAddrMissing; + BEAM_LOG_ERROR() << kErrorReceiverAddrMissing; return false; } @@ -137,7 +137,7 @@ namespace beam::wallet } break; default: - LOG_ERROR() << kErrorReceiverAddrMissing; + BEAM_LOG_ERROR() << kErrorReceiverAddrMissing; return false; } diff --git a/wallet/client/apps_api/apps_api.cpp b/wallet/client/apps_api/apps_api.cpp index 54c8bb25c..3a9350cb2 100644 --- a/wallet/client/apps_api/apps_api.cpp +++ b/wallet/client/apps_api/apps_api.cpp @@ -19,20 +19,20 @@ namespace beam::wallet { for (const auto& pair: info.items()) { - LOG_INFO () << prefix << pair.key() << " = " << pair.value(); + BEAM_LOG_INFO () << prefix << pair.key() << " = " << pair.value(); } } void printApproveLog(const std::string& preamble, const std::string& appid, const std::string& appname, const json& info, const json& amounts) { - LOG_INFO() << preamble << " (" << appname << ", " << appid << "):"; + BEAM_LOG_INFO() << preamble << " (" << appname << ", " << appid << "):"; printMap("\t", info); if (!amounts.empty()) { for (const auto &amountMap : amounts) { - LOG_INFO() << "\tamount entry:"; + BEAM_LOG_INFO() << "\tamount entry:"; printMap("\t\t", amountMap); } } diff --git a/wallet/client/apps_api/apps_api.h b/wallet/client/apps_api/apps_api.h index abd816ec5..0aa6d44ba 100644 --- a/wallet/client/apps_api/apps_api.h +++ b/wallet/client/apps_api/apps_api.h @@ -62,7 +62,7 @@ namespace beam::wallet [] (const boost::any&){ } ); - LOG_INFO () << "AppsApi destroyed for " << _appName << ", " << _appId; + BEAM_LOG_INFO () << "AppsApi destroyed for " << _appName << ", " << _appId; } public: @@ -109,7 +109,7 @@ namespace beam::wallet catch(const std::runtime_error& err) { assert(false); - LOG_ERROR() << "Failed to start IPFS node: " << err.what(); + BEAM_LOG_ERROR() << "Failed to start IPFS node: " << err.what(); } } #else @@ -117,7 +117,7 @@ namespace beam::wallet #endif if (!hasIPFSNode) { - LOG_INFO() << "IPFS Node is not running. IPFS would not be available for the '" + BEAM_LOG_INFO() << "IPFS Node is not running. IPFS would not be available for the '" << appname << "' DApp"; } @@ -148,7 +148,7 @@ namespace beam::wallet #endif wapi->_walletAPI = IWalletApi::CreateInstance(version, *wapi->_walletAPIProxy, data); - LOG_INFO () << "AppsApi created for " << appid << ", " << appname << ", privileges " << privilegeLvl; + BEAM_LOG_INFO () << "AppsApi created for " << appid << ", " << appname << ", privileges " << privilegeLvl; cback(std::move(wapi)); } ); @@ -166,7 +166,7 @@ namespace beam::wallet void AnyThread_callWalletApiDirectly(const std::string& request) { - //LOG_INFO () << "AppsApi direct call for " << getAppName() << ", " << getAppId() << "): " << request; + //BEAM_LOG_INFO () << "AppsApi direct call for " << getAppName() << ", " << getAppId() << "): " << request; // // Do not assume thread here @@ -189,7 +189,7 @@ namespace beam::wallet IWalletApi::ParseResult data; }; - // LOG_INFO () << "AppsApi checked call for " << getAppName() << ", " << getAppId() << "): " << request; + // BEAM_LOG_INFO () << "AppsApi checked call for " << getAppName() << ", " << getAppId() << "): " << request; makeIWTCallGuarded( [this, request]() mutable -> boost::any { if (auto pres = _walletAPI->parseAPIRequest(request.c_str(), request.size()); pres) @@ -211,7 +211,7 @@ namespace beam::wallet if (pres->minfo.fee > 0 || !pres->minfo.spend.empty()) { - LOG_INFO() << "Application called method " << acinfo.method << " that spends funds, but user consent is not handled"; + BEAM_LOG_INFO() << "Application called method " << acinfo.method << " that spends funds, but user consent is not handled"; assert(false); AnyThread_sendApiError(request, ApiError::NotAllowedError, std::string()); @@ -222,14 +222,14 @@ namespace beam::wallet return {}; } - LOG_INFO() << "Application requested call of the not allowed method: " << pres->acinfo.method; + BEAM_LOG_INFO() << "Application requested call of the not allowed method: " << pres->acinfo.method; AnyThread_sendApiError(request, ApiError::NotAllowedError, std::string()); return {}; } else { // parse failed, just log error and return. Error response is already sent back - LOG_ERROR() << "WebAPP API parse failed: " << request; + BEAM_LOG_ERROR() << "WebAPP API parse failed: " << request; return {}; } }, @@ -432,7 +432,7 @@ namespace beam::wallet if (!locked) { // Can happen if user leaves the application - LOG_WARNING() << "UIT send CSI arrived but apps api is already destroyed"; + BEAM_LOG_WARNING() << "UIT send CSI arrived but apps api is already destroyed"; } info.push_back({"isEnough", csi.m_isEnought}); diff --git a/wallet/client/extensions/broadcast_gateway/broadcast_msg_validator.cpp b/wallet/client/extensions/broadcast_gateway/broadcast_msg_validator.cpp index 807ecd372..40bc385c8 100644 --- a/wallet/client/extensions/broadcast_gateway/broadcast_msg_validator.cpp +++ b/wallet/client/extensions/broadcast_gateway/broadcast_msg_validator.cpp @@ -55,7 +55,7 @@ namespace beam::wallet } catch(...) { - LOG_WARNING() << "broadcast message signature deserialization exception"; + BEAM_LOG_WARNING() << "broadcast message signature deserialization exception"; return false; } signValidator.m_data = msg.m_content; diff --git a/wallet/client/extensions/dex_board/dex_board.cpp b/wallet/client/extensions/dex_board/dex_board.cpp index b1c8f1cb5..f80cac734 100644 --- a/wallet/client/extensions/dex_board/dex_board.cpp +++ b/wallet/client/extensions/dex_board/dex_board.cpp @@ -35,7 +35,7 @@ namespace beam::wallet { } catch(...) { - LOG_WARNING() << "DexBoard load order error"; + BEAM_LOG_WARNING() << "DexBoard load order error"; } } @@ -141,12 +141,12 @@ namespace beam::wallet { } catch(std::runtime_error& err) { - LOG_WARNING() << "DexBoard parse error: " << err.what(); + BEAM_LOG_WARNING() << "DexBoard parse error: " << err.what(); return boost::none; } catch(...) { - LOG_WARNING() << "DexBoard message type parse error"; + BEAM_LOG_WARNING() << "DexBoard message type parse error"; return boost::none; } } diff --git a/wallet/client/extensions/news_channels/exchange_rate_provider.cpp b/wallet/client/extensions/news_channels/exchange_rate_provider.cpp index 1025d603c..1475dde9e 100644 --- a/wallet/client/extensions/news_channels/exchange_rate_provider.cpp +++ b/wallet/client/extensions/news_channels/exchange_rate_provider.cpp @@ -24,7 +24,7 @@ namespace beam::wallet { { beam::wallet::PrintableAmount amount(rate.m_rate, true /*show decimal point*/); - LOG_VERBOSE() << "Exchange rate (updated " << format_timestamp(kTimeStampFormat3x3, rate.m_updateTime * 1000, false) << "): 1 " << rate.m_from.m_value << " = " + BEAM_LOG_VERBOSE() << "Exchange rate (updated " << format_timestamp(kTimeStampFormat3x3, rate.m_updateTime * 1000, false) << "): 1 " << rate.m_from.m_value << " = " << amount << " " << rate.m_to.m_value; } } @@ -125,12 +125,12 @@ namespace beam::wallet } catch(const std::exception& ex) { - LOG_WARNING() << "broadcast rate message processing exception: " << ex.what(); + BEAM_LOG_WARNING() << "broadcast rate message processing exception: " << ex.what(); return false; } catch(...) { - LOG_WARNING() << "broadcast rate message processing exception"; + BEAM_LOG_WARNING() << "broadcast rate message processing exception"; return false; } } diff --git a/wallet/client/extensions/news_channels/updates_provider.cpp b/wallet/client/extensions/news_channels/updates_provider.cpp index c812cc2a2..9c72a7f07 100644 --- a/wallet/client/extensions/news_channels/updates_provider.cpp +++ b/wallet/client/extensions/news_channels/updates_provider.cpp @@ -44,7 +44,7 @@ namespace beam::wallet } catch(...) { - LOG_WARNING() << "broadcast message processing exception"; + BEAM_LOG_WARNING() << "broadcast message processing exception"; return false; } } diff --git a/wallet/client/extensions/news_channels/verification_provider.cpp b/wallet/client/extensions/news_channels/verification_provider.cpp index e957c65be..8685e5147 100644 --- a/wallet/client/extensions/news_channels/verification_provider.cpp +++ b/wallet/client/extensions/news_channels/verification_provider.cpp @@ -41,7 +41,7 @@ namespace beam::wallet } catch(...) { - LOG_WARNING() << "VerificationProvider: broadcast message processing exception"; + BEAM_LOG_WARNING() << "VerificationProvider: broadcast message processing exception"; } } return false; diff --git a/wallet/client/extensions/news_channels/wallet_updates_provider.cpp b/wallet/client/extensions/news_channels/wallet_updates_provider.cpp index 964404412..c7b4e05c0 100644 --- a/wallet/client/extensions/news_channels/wallet_updates_provider.cpp +++ b/wallet/client/extensions/news_channels/wallet_updates_provider.cpp @@ -44,7 +44,7 @@ namespace beam::wallet } catch(...) { - LOG_WARNING() << "broadcast message processing exception"; + BEAM_LOG_WARNING() << "broadcast message processing exception"; return false; } } diff --git a/wallet/client/extensions/notifications/notification_center.cpp b/wallet/client/extensions/notifications/notification_center.cpp index bc571fbc4..b02d5759f 100644 --- a/wallet/client/extensions/notifications/notification_center.cpp +++ b/wallet/client/extensions/notifications/notification_center.cpp @@ -42,11 +42,11 @@ namespace beam::wallet } catch(const std::exception& e) { - LOG_ERROR() << "Notifications loading failed: " << e.what(); + BEAM_LOG_ERROR() << "Notifications loading failed: " << e.what(); } catch(...) { - LOG_ERROR() << "Notifications loading failed."; + BEAM_LOG_ERROR() << "Notifications loading failed."; } for (const auto& notification : notifications) diff --git a/wallet/client/extensions/offers_board/offers_protocol_handler.cpp b/wallet/client/extensions/offers_board/offers_protocol_handler.cpp index f014f4d8c..c8858b2cf 100644 --- a/wallet/client/extensions/offers_board/offers_protocol_handler.cpp +++ b/wallet/client/extensions/offers_board/offers_protocol_handler.cpp @@ -47,7 +47,7 @@ namespace beam::wallet signHandler.m_data = msg.m_content; if (token.getPublicKey() && !signHandler.IsValid(token.getPublicKey()->m_Pk)) { - LOG_WARNING() << "offer board message signature is invalid"; + BEAM_LOG_WARNING() << "offer board message signature is invalid"; return boost::none; } return token.Unpack(); @@ -56,7 +56,7 @@ namespace beam::wallet catch(...) { } - LOG_WARNING() << "offer board message deserialization exception"; + BEAM_LOG_WARNING() << "offer board message deserialization exception"; return boost::none; } diff --git a/wallet/client/extensions/offers_board/swap_offers_board.cpp b/wallet/client/extensions/offers_board/swap_offers_board.cpp index 4b850a833..3ec366a13 100644 --- a/wallet/client/extensions/offers_board/swap_offers_board.cpp +++ b/wallet/client/extensions/offers_board/swap_offers_board.cpp @@ -174,7 +174,7 @@ void SwapOffersBoard::publishOffer(const SwapOffer& offer) const auto responseTime = offer.GetParameter(TxParameterID::PeerResponseTime); auto minimalHeight = offer.GetParameter(TxParameterID::MinHeight); - LOG_INFO() << offer.m_txId << " Publish offer.\n\t" + BEAM_LOG_INFO() << offer.m_txId << " Publish offer.\n\t" << "isBeamSide: " << (*isBeamSide ? "false" : "true") << "\n\t" << "swapCoin: " << std::to_string(*swapCoin) << "\n\t" << "amount: " << *amount << "\n\t" @@ -200,7 +200,7 @@ bool SwapOffersBoard::onOfferFromNetwork(SwapOffer& newOffer) { if (newOffer.m_coin >= AtomicSwapCoin::Unknown || newOffer.m_status > SwapOfferStatus::Failed) { - LOG_WARNING() << "offer board message is invalid"; + BEAM_LOG_WARNING() << "offer board message is invalid"; return false; } @@ -213,7 +213,7 @@ bool SwapOffersBoard::onOfferFromNetwork(SwapOffer& newOffer) { if (!newOffer.IsValid()) { - LOG_WARNING() << "incoming offer is invalid"; + BEAM_LOG_WARNING() << "incoming offer is invalid"; return false; } if (isOfferExpired(newOffer)) @@ -336,7 +336,7 @@ void SwapOffersBoard::updateOfferStatus(const TxID& offerTxID, SwapOfferStatus n */ void SwapOffersBoard::sendUpdateToNetwork(const SwapOffer& offer) const { - LOG_INFO() << offer.m_txId << " offer status updated to " << std::to_string(offer.m_status); + BEAM_LOG_INFO() << offer.m_txId << " offer status updated to " << std::to_string(offer.m_status); auto it = m_ownAddresses.find(offer.m_publisherId); diff --git a/wallet/client/wallet_client.cpp b/wallet/client/wallet_client.cpp index eb603975c..2a835f7c5 100644 --- a/wallet/client/wallet_client.cpp +++ b/wallet/client/wallet_client.cpp @@ -600,10 +600,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -803,9 +803,9 @@ namespace beam::wallet void AnyThread_onStatus(const std::string& error, uint32_t peercnt) override { _wc->getAsync()->makeIWTCall([this, error, peercnt]() -> boost::any { if (error.empty()) { - LOG_INFO() << "IPFS Status: peers count " << peercnt; + BEAM_LOG_INFO() << "IPFS Status: peers count " << peercnt; } else { - LOG_INFO() << "IPFS Status: peers count " << peercnt << ", error: " << error; + BEAM_LOG_INFO() << "IPFS Status: peers count " << peercnt << ", error: " << error; } _wc->m_ipfsError = error; _wc->m_ipfsPeerCnt = static_cast(peercnt); @@ -823,12 +823,12 @@ namespace beam::wallet std::shared_ptr ipfsHandler; std::shared_ptr ipfsService; - LOG_INFO() << "IPFS Service is enabled."; + BEAM_LOG_INFO() << "IPFS Service is enabled."; ipfsHandler = std::make_shared(this); ipfsService = IPFSService::AnyThread_create(ipfsHandler); m_ipfs = ipfsService; #else - LOG_INFO () << "IPFS Service is disabled."; + BEAM_LOG_INFO () << "IPFS Service is disabled."; #endif // @@ -875,15 +875,15 @@ namespace beam::wallet } catch (const runtime_error& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); FailedToStartWallet(); } catch (const std::exception& ex) { - LOG_UNHANDLED_EXCEPTION() << "what = " << ex.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << ex.what(); } /*catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); }*/ onStopped(); }); @@ -951,7 +951,7 @@ namespace beam::wallet catch(std::runtime_error& err) { auto errmsg = std::string("Failed to start IPFS service. ") + err.what(); - LOG_ERROR() << errmsg; + BEAM_LOG_ERROR() << errmsg; m_ipfsError = errmsg; m_ipfsPeerCnt = 0; getIPFSStatus(); @@ -989,7 +989,7 @@ namespace beam::wallet catch(std::runtime_error& err) { auto errmsg = std::string("Failed to start IPFS service. ") + err.what(); - LOG_ERROR() << errmsg; + BEAM_LOG_ERROR() << errmsg; m_ipfsError = errmsg; m_ipfsPeerCnt = 0; getIPFSStatus(); @@ -1020,7 +1020,7 @@ namespace beam::wallet catch(std::runtime_error& err) { auto errmsg = std::string("Failed to start IPFS service. ") + err.what(); - LOG_ERROR() << errmsg; + BEAM_LOG_ERROR() << errmsg; m_ipfsError = errmsg; m_ipfsPeerCnt = 0; getIPFSStatus(); @@ -1395,10 +1395,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1425,10 +1425,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1528,10 +1528,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1559,7 +1559,7 @@ namespace beam::wallet } catch (const std::runtime_error& e) { - LOG_ERROR() << offer.m_txId << e.what(); + BEAM_LOG_ERROR() << offer.m_txId << e.what(); } } } @@ -1602,10 +1602,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } callback(std::move(res)); @@ -1655,10 +1655,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1680,10 +1680,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1725,10 +1725,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } postFunctionToClientContext([sToken = std::move(sToken), cb = std::move(callback)]() mutable @@ -1745,10 +1745,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1760,10 +1760,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1794,10 +1794,10 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1818,12 +1818,12 @@ namespace beam::wallet } else { - LOG_ERROR() << "Address " << to_string(wid) << " is absent."; + BEAM_LOG_ERROR() << "Address " << to_string(wid) << " is absent."; } } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } } @@ -1844,12 +1844,12 @@ namespace beam::wallet } else { - LOG_ERROR() << "Address " << to_string(wid) << " is absent."; + BEAM_LOG_ERROR() << "Address " << to_string(wid) << " is absent."; } } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } } @@ -1868,16 +1868,16 @@ namespace beam::wallet } else { - LOG_ERROR() << "Address " << to_string(wid) << " is absent."; + BEAM_LOG_ERROR() << "Address " << to_string(wid) << " is absent."; } } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1911,11 +1911,11 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1927,11 +1927,11 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -1950,7 +1950,7 @@ namespace beam::wallet } else { - LOG_ERROR() << "Unable to resolve node address: " << addr; + BEAM_LOG_ERROR() << "Unable to resolve node address: " << addr; onWalletError(ErrorType::HostResolvedError); } } @@ -2076,11 +2076,11 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -2110,11 +2110,11 @@ namespace beam::wallet } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } onWalletError(ErrorType::ImportRecoveryError); } @@ -2288,7 +2288,7 @@ namespace beam::wallet if (!address.resolve(host.c_str())) { - LOG_ERROR() << "Unable to resolve address: " << host; + BEAM_LOG_ERROR() << "Unable to resolve address: " << host; postFunctionToClientContext([cb = std::move(callback)]() { @@ -2333,15 +2333,15 @@ namespace beam::wallet } else if (msg.what == HttpMsgReader::connection_error) { - LOG_ERROR() << "Failed to load application list: conection error(" << msg.connectionError << ")"; + BEAM_LOG_ERROR() << "Failed to load application list: conection error(" << msg.connectionError << ")"; } else if (msg.what == HttpMsgReader::message_corrupted) { - LOG_ERROR() << "Failed to load application list: corrupted message"; + BEAM_LOG_ERROR() << "Failed to load application list: corrupted message"; } else { - LOG_ERROR() << "Failed to load application list reason: " << msg.what; + BEAM_LOG_ERROR() << "Failed to load application list reason: " << msg.what; } postFunctionToClientContext([isOk, res = std::move(response), callback = std::move(cb)]() @@ -2493,7 +2493,7 @@ namespace beam::wallet return; } - LOG_ERROR() << "Unprocessed error: " << reason; + BEAM_LOG_ERROR() << "Unprocessed error: " << reason; } void WalletClient::onNodeConnectedStatusChanged(bool isNodeConnected) @@ -2774,14 +2774,14 @@ namespace beam::wallet auto smgr = _clientShaders.lock(); if (!smgr) { - LOG_WARNING () << "onShaderDone but empty manager. This can happen if node changed."; + BEAM_LOG_WARNING () << "onShaderDone but empty manager. This can happen if node changed."; return; } if (!cb) { assert(false); - LOG_ERROR() << "onShaderDone but empty callback"; + BEAM_LOG_ERROR() << "onShaderDone but empty callback"; return; } @@ -2824,14 +2824,14 @@ namespace beam::wallet auto smgr = _clientShaders.lock(); if (!smgr) { - LOG_WARNING() << "onShaderDone but empty manager. This can happen if node changed."; + BEAM_LOG_WARNING() << "onShaderDone but empty manager. This can happen if node changed."; return; } if (!cb) { assert(false); - LOG_ERROR() << "onShaderDone but empty callback"; + BEAM_LOG_ERROR() << "onShaderDone but empty callback"; return; } @@ -2873,14 +2873,14 @@ namespace beam::wallet auto smgr = _clientShaders.lock(); if (!smgr) { - LOG_WARNING() << "onShaderDone but empty manager. This can happen if node changed."; + BEAM_LOG_WARNING() << "onShaderDone but empty manager. This can happen if node changed."; return; } if (!cb) { assert(false); - LOG_ERROR() << "onShaderDone but empty callback"; + BEAM_LOG_ERROR() << "onShaderDone but empty callback"; return; } diff --git a/wallet/core/assets_utils.cpp b/wallet/core/assets_utils.cpp index e707f0813..97333c439 100644 --- a/wallet/core/assets_utils.cpp +++ b/wallet/core/assets_utils.cpp @@ -58,7 +58,7 @@ namespace beam::wallet { Parse(); } catch (const std::exception& exc) { - LOG_WARNING() << "AssetID " << info.m_ID << " failed to deserialize metadata: " << exc.what(); + BEAM_LOG_WARNING() << "AssetID " << info.m_ID << " failed to deserialize metadata: " << exc.what(); } } @@ -154,7 +154,7 @@ namespace beam::wallet { ss << "[CANNOT BE PRINTED, size is " << value.size() << " bytes]"; value = ss.str(); } - LOG_INFO() << prefix << it.first << "=" << value; + BEAM_LOG_INFO() << prefix << it.first << "=" << value; } } @@ -295,19 +295,19 @@ namespace beam::wallet { { const auto prefix = pref.empty() ? pref : pref + " "; - LOG_INFO() << prefix << "Asset ID: " << m_ID; - LOG_INFO() << prefix << "Owner ID: " << m_Owner; - LOG_INFO() << prefix << "Issued amount: " << PrintableAmount(m_Value); - LOG_INFO() << prefix << "Lock Height: " << m_LockHeight; - LOG_INFO() << prefix << "Refresh height: " << m_RefreshHeight; - LOG_INFO() << prefix << "Metadata size: " << m_Metadata.m_Value.size() << " bytes"; + BEAM_LOG_INFO() << prefix << "Asset ID: " << m_ID; + BEAM_LOG_INFO() << prefix << "Owner ID: " << m_Owner; + BEAM_LOG_INFO() << prefix << "Issued amount: " << PrintableAmount(m_Value); + BEAM_LOG_INFO() << prefix << "Lock Height: " << m_LockHeight; + BEAM_LOG_INFO() << prefix << "Refresh height: " << m_RefreshHeight; + BEAM_LOG_INFO() << prefix << "Metadata size: " << m_Metadata.m_Value.size() << " bytes"; const WalletAssetMeta meta(*this); meta.LogInfo(pref + "\t"); if(m_IsOwned) { - LOG_INFO() << prefix << "You own this asset"; + BEAM_LOG_INFO() << prefix << "You own this asset"; } } diff --git a/wallet/core/base_transaction.cpp b/wallet/core/base_transaction.cpp index 44a3d4cf5..9c0411ff6 100644 --- a/wallet/core/base_transaction.cpp +++ b/wallet/core/base_transaction.cpp @@ -193,7 +193,7 @@ namespace beam::wallet { if (ex.what() && strlen(ex.what())) { - LOG_ERROR() << m_Context << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_Context << " exception msg: " << ex.what(); } OnFailed(ex.GetReason(), ex.ShouldNofify()); } @@ -201,7 +201,7 @@ namespace beam::wallet { if (ex.what() && strlen(ex.what())) { - LOG_ERROR() << m_Context << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_Context << " exception msg: " << ex.what(); } OnFailed(TxFailureReason::Unknown); } @@ -234,7 +234,7 @@ namespace beam::wallet } else { - LOG_INFO() << m_Context << " You cannot cancel transaction in state: " << static_cast(s); + BEAM_LOG_INFO() << m_Context << " You cannot cancel transaction in state: " << static_cast(s); } } @@ -264,7 +264,7 @@ namespace beam::wallet void BaseTransaction::RollbackTx() { - LOG_INFO() << m_Context << " Transaction failed. Rollback..."; + BEAM_LOG_INFO() << m_Context << " Transaction failed. Rollback..."; auto db = m_Context.GetWalletDB(); db->restoreCoinsSpentByTx(GetTxID()); db->deleteCoinsCreatedByTx(GetTxID()); @@ -317,7 +317,7 @@ namespace beam::wallet Block::SystemState::Full state; if (GetTip(state) && state.m_Height > maxHeight) { - LOG_INFO() << m_Context << " Transaction expired. Current height: " << state.m_Height << ", max kernel height: " << maxHeight; + BEAM_LOG_INFO() << m_Context << " Transaction expired. Current height: " << state.m_Height << ", max kernel height: " << maxHeight; OnFailed(TxFailureReason::TransactionExpired); return true; } @@ -330,7 +330,7 @@ namespace beam::wallet { if (lastUnconfirmedHeight >= maxHeight) { - LOG_INFO() << m_Context << " Transaction expired. Last unconfirmeed height: " << lastUnconfirmedHeight << ", max kernel height: " << maxHeight; + BEAM_LOG_INFO() << m_Context << " Transaction expired. Last unconfirmeed height: " << lastUnconfirmedHeight << ", max kernel height: " << maxHeight; OnFailed(TxFailureReason::TransactionExpired); return true; } @@ -403,7 +403,7 @@ namespace beam::wallet } } - LOG_INFO() << m_Context << " Transaction completed"; + BEAM_LOG_INFO() << m_Context << " Transaction completed"; UpdateTxDescription(TxStatus::Completed); GetGateway().on_tx_completed(GetTxID()); } @@ -415,7 +415,7 @@ namespace beam::wallet void BaseTransaction::OnFailed(TxFailureReason reason, bool notify) { - LOG_ERROR() << m_Context << " Failed. " << GetFailureMessage(reason); + BEAM_LOG_ERROR() << m_Context << " Failed. " << GetFailureMessage(reason); if (notify) { @@ -635,7 +635,7 @@ namespace beam::wallet void BaseTransaction::LogFailedParameter(TxParameterID paramID, SubTxID subTxID) const { - LOG_ERROR() << GetTxID() << "[" << subTxID << "] Failed to get parameter: " << (int)paramID; + BEAM_LOG_ERROR() << GetTxID() << "[" << subTxID << "] Failed to get parameter: " << (int)paramID; } BaseTransaction::AssetCheckResult BaseTransaction::CheckAsset(Asset::ID assetId) diff --git a/wallet/core/base_tx_builder.cpp b/wallet/core/base_tx_builder.cpp index c4631ebca..da5680026 100644 --- a/wallet/core/base_tx_builder.cpp +++ b/wallet/core/base_tx_builder.cpp @@ -248,7 +248,7 @@ namespace beam::wallet if (val < 0) { - LOG_ERROR() + BEAM_LOG_ERROR() << m_Builder.m_Tx.GetTxID() << "[" << m_Builder.m_SubTxID << "]" << " Missing " @@ -365,7 +365,7 @@ namespace beam::wallet else { auto message("Coin with ID: " + toString(coin.m_ID) + " is unreachable."); - LOG_ERROR() << message; + BEAM_LOG_ERROR() << message; throw TransactionFailedException(true, TxFailureReason::NoInputs, message.c_str()); } } @@ -710,7 +710,7 @@ namespace beam::wallet m_Count += nExtra; } - LOG_INFO() << "ShieldedInput window N=" << m_N << ", Wnd0=" << m_Wnd0 << ", iIdx=" << m_Method.m_iIdx << ", TxoID=" << c.m_TxoID << ", PoolSize=" << nShieldedCurrently; + BEAM_LOG_INFO() << "ShieldedInput window N=" << m_N << ", Wnd0=" << m_Wnd0 << ", iIdx=" << m_Method.m_iIdx << ", TxoID=" << c.m_TxoID << ", PoolSize=" << nShieldedCurrently; b.m_Tx.GetGateway().get_shielded_list(b.m_Tx.GetTxID(), m_Wnd0, m_Count, [pHandler = shared_from_this(), weakTx = b.m_Tx.weak_from_this()](TxoID, uint32_t, proto::ShieldedList& msg) @@ -740,7 +740,7 @@ namespace beam::wallet { if (msg.m_Items.size() > m_Count) { - LOG_ERROR() << "ShieldedList message returned more coins than requested " << TRACE(msg.m_Items.size()) << TRACE(m_Count); + BEAM_LOG_ERROR() << "ShieldedList message returned more coins than requested " << TRACE(msg.m_Items.size()) << TRACE(m_Count); return false; } @@ -769,7 +769,7 @@ namespace beam::wallet { if (m_Wnd0 || (nItems <= m_Method.m_iIdx)) { - LOG_ERROR() << "ShieldedList message returned unexpected data " << TRACE(m_Wnd0) << TRACE(nItems) << TRACE(m_Method.m_iIdx); + BEAM_LOG_ERROR() << "ShieldedList message returned unexpected data " << TRACE(m_Wnd0) << TRACE(nItems) << TRACE(m_Method.m_iIdx); return false; } diff --git a/wallet/core/common.cpp b/wallet/core/common.cpp index 68ad7e6dd..65ba5d27f 100644 --- a/wallet/core/common.cpp +++ b/wallet/core/common.cpp @@ -666,7 +666,7 @@ namespace beam::wallet { if (!IsValidVoucherList(*vouchers, *peerEndpoint)) { - LOG_ERROR() << "Voucher signature verification failed. Unauthorized voucher was provider."; + BEAM_LOG_ERROR() << "Voucher signature verification failed. Unauthorized voucher was provider."; return false; } params.SetParameter(TxParameterID::ShieldedVoucherList, *vouchers); @@ -682,7 +682,7 @@ namespace beam::wallet auto voucher = p.GetParameter(TxParameterID::Voucher); if (!voucher->IsValid(*peerEndpoint)) { - LOG_ERROR() << "Voucher signature verification failed. Unauthorized voucher was provider."; + BEAM_LOG_ERROR() << "Voucher signature verification failed. Unauthorized voucher was provider."; return false; } params.SetParameter(TxParameterID::Voucher, *voucher); @@ -706,7 +706,7 @@ namespace beam::wallet if (currentTime_s > currentBlockTime_s + tolerance_s) { - LOG_INFO() << "It seems that last known blockchain tip is not up to date"; + BEAM_LOG_INFO() << "It seems that last known blockchain tip is not up to date"; return false; } return true; @@ -1610,7 +1610,7 @@ namespace beam::wallet } else { - LOG_WARNING() << + BEAM_LOG_WARNING() << "This address generated by newer Beam library version(" << versionStr << ")\n" << "Your version is: " << myLibVersionStr << " Please, check for updates."; } diff --git a/wallet/core/contract_transaction.cpp b/wallet/core/contract_transaction.cpp index c20102a2c..aef5bd4eb 100644 --- a/wallet/core/contract_transaction.cpp +++ b/wallet/core/contract_transaction.cpp @@ -586,7 +586,7 @@ namespace beam::wallet void ContractTransaction::MyBuilder::OnRebuildFailed() { - LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT rebuild failed"; + BEAM_LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT rebuild failed"; m_RebuildFailed = true; m_Tx.SetState(State::Registration); } @@ -610,7 +610,7 @@ namespace beam::wallet if (builder.IsHftPending()) { builder.OnRebuildFailed(); - LOG_INFO() << "already pending"; + BEAM_LOG_INFO() << "already pending"; return true; } @@ -622,7 +622,7 @@ namespace beam::wallet if ((builder.m_HftState.m_Variants.end() != it) && (it->m_Key.m_Height <= sTip.m_Height)) { builder.OnRebuildFailed(); - LOG_INFO() << "waiting prev unconfirm"; + BEAM_LOG_INFO() << "waiting prev unconfirm"; return true; } @@ -633,7 +633,7 @@ namespace beam::wallet // is it any different now? if (builder.m_pParentCtx && (builder.m_pParentCtx->m_Hash == hvCtx)) { - LOG_INFO() << "same state"; + BEAM_LOG_INFO() << "same state"; return false; // retry when the state changes } @@ -665,7 +665,7 @@ namespace beam::wallet if (aex.m_InvokeData.m_vec.empty()) { builder.OnRebuildFailed(); - LOG_INFO() << "no invoke"; + BEAM_LOG_INFO() << "no invoke"; return true; } @@ -680,7 +680,7 @@ namespace beam::wallet if (!builder.m_pParentCtx) { builder.OnRebuildFailed(); - LOG_INFO() << "not HFT"; + BEAM_LOG_INFO() << "not HFT"; return true; } @@ -709,7 +709,7 @@ namespace beam::wallet if (bCheckLimits && !builder.IsSpendWithinLimits(fm)) { builder.OnRebuildFailed(); - LOG_INFO() << "slippage too large"; + BEAM_LOG_INFO() << "slippage too large"; if (builder.m_HftState.m_Variants.empty()) { @@ -924,7 +924,7 @@ namespace beam::wallet catch (const std::exception& e) { builder.OnRebuildFailed(); - LOG_INFO() << "TxoID=" << GetTxID() << " error " << e.what(); + BEAM_LOG_INFO() << "TxoID=" << GetTxID() << " error " << e.what(); } } @@ -940,7 +940,7 @@ namespace beam::wallet if (RetryHft()) { - LOG_INFO() << "TxoID=" << GetTxID() << " Expired. Retrying HFT tx"; + BEAM_LOG_INFO() << "TxoID=" << GetTxID() << " Expired. Retrying HFT tx"; UpdateAsync(); } else @@ -991,7 +991,7 @@ namespace beam::wallet } } - LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT confirmed"; + BEAM_LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT confirmed"; SetParameter(TxParameterID::KernelProofHeight, *pHeight); DeleteAsyncCtx(); @@ -1061,7 +1061,7 @@ namespace beam::wallet return; SetParameter(TxParameterID::KernelUnconfirmedHeight, m_pAsyncCtx->m_hTipAtStart); - LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT unconfirmed at " << m_pAsyncCtx->m_hTipAtStart; + BEAM_LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT unconfirmed at " << m_pAsyncCtx->m_hTipAtStart; } m_Tx.UpdateAsync(); @@ -1091,7 +1091,7 @@ namespace beam::wallet for (const auto& pKrn : m_pTransaction->m_vKernels) DependentContext::get_Ancestor(hv, hv, pKrn->m_Internal.m_ID); - LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT variant: " << *m_pNewCtx; + BEAM_LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT variant: " << *m_pNewCtx; } void ContractTransaction::MyBuilder::ConfirmHfts(Height hLastUnconfirmed, Height hTip) @@ -1128,7 +1128,7 @@ namespace beam::wallet } if (m_pAsyncCtx->m_Remaining) - LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT confirming variants: " << m_pAsyncCtx->m_Remaining; + BEAM_LOG_INFO() << "TxoID=" << m_Tx.GetTxID() << " HFT confirming variants: " << m_pAsyncCtx->m_Remaining; } int ContractTransaction::RegisterTx() diff --git a/wallet/core/contracts/shaders_manager.cpp b/wallet/core/contracts/shaders_manager.cpp index 678469aef..608ec4da1 100644 --- a/wallet/core/contracts/shaders_manager.cpp +++ b/wallet/core/contracts/shaders_manager.cpp @@ -234,7 +234,7 @@ namespace beam::wallet { return nextRequest(); } - LOG_VERBOSE() << "shader call is still in progress, request " << args << " queued"; + BEAM_LOG_VERBOSE() << "shader call is still in progress, request " << args << " queued"; } void ShadersManager::CallShader(std::vector&& shader, std::string&& args, unsigned method, uint32_t priority, uint32_t unique, DoneCallHandler doneHandler) @@ -253,7 +253,7 @@ namespace beam::wallet { return nextRequest(); } - LOG_VERBOSE () << "shader call is still in progress, request " << args << " queued"; + BEAM_LOG_VERBOSE () << "shader call is still in progress, request " << args << " queued"; } void ShadersManager::nextRequest() @@ -322,11 +322,11 @@ namespace beam::wallet { if (_currentAppId.empty() && _currentAppName.empty()) { - LOG_INFO () << "ShadersManager::ProcessTxData"; + BEAM_LOG_INFO () << "ShadersManager::ProcessTxData"; } else { - LOG_INFO () << "ShadersManager::ProcessTxData for " << _currentAppId << ", " << _currentAppName; + BEAM_LOG_INFO () << "ShadersManager::ProcessTxData for " << _currentAppId << ", " << _currentAppName; } auto params = CreateTransactionParameters(TxType::Contract) @@ -357,7 +357,7 @@ namespace beam::wallet { { if (_queue.empty()) { - LOG_WARNING() << "Queue has been cleared before request completed"; + BEAM_LOG_WARNING() << "Queue has been cleared before request completed"; return; } @@ -381,7 +381,7 @@ namespace beam::wallet { error = std::string("unknown error"); } - LOG_INFO() << "Shader Error: " << *error; + BEAM_LOG_INFO() << "Shader Error: " << *error; if (req.doneAll) { return req.doneAll(boost::none, boost::none, std::move(error)); @@ -395,7 +395,7 @@ namespace beam::wallet { boost::optional result = m_Out.str(); if (_logResult) { - LOG_VERBOSE () << "Shader result: " << std::string_view(result ? *result : std::string()).substr(0, 200); + BEAM_LOG_VERBOSE () << "Shader result: " << std::string_view(result ? *result : std::string()).substr(0, 200); } if (m_InvokeData.m_vec.empty()) diff --git a/wallet/core/currency.cpp b/wallet/core/currency.cpp index ef1e1089c..2ca540bf7 100644 --- a/wallet/core/currency.cpp +++ b/wallet/core/currency.cpp @@ -51,7 +51,7 @@ namespace beam::wallet { } catch(const std::runtime_error& err) { - LOG_WARNING() << "Failed to parse asset id from currency: " << m_value + BEAM_LOG_WARNING() << "Failed to parse asset id from currency: " << m_value << ", " << err.what(); } } diff --git a/wallet/core/node_network.cpp b/wallet/core/node_network.cpp index 40e097120..f017f77ba 100644 --- a/wallet/core/node_network.cpp +++ b/wallet/core/node_network.cpp @@ -55,7 +55,7 @@ namespace beam::wallet } else { - LOG_WARNING() << "Unable to resolve node address: " << addr; + BEAM_LOG_WARNING() << "Unable to resolve node address: " << addr; } } if (!m_Cfg.m_vNodes.empty()) @@ -66,17 +66,17 @@ namespace beam::wallet return; } - LOG_WARNING() << "User-specified nodes cannot be resolved."; + BEAM_LOG_WARNING() << "User-specified nodes cannot be resolved."; if (!m_fallbackAddresses.empty()) { - LOG_WARNING() << "Attempting to connect to fallback nodes"; + BEAM_LOG_WARNING() << "Attempting to connect to fallback nodes"; // try to solve DNS problem with known ip addresses std::copy(m_fallbackAddresses.begin(), m_fallbackAddresses.end(), std::back_inserter(m_Cfg.m_vNodes)); Connect(); } else { - LOG_WARNING() << "There are no fallback nodes. Trying to re-connect in " << RECONNECTION_TIMEOUT << " ms"; + BEAM_LOG_WARNING() << "There are no fallback nodes. Trying to re-connect in " << RECONNECTION_TIMEOUT << " ms"; tryToConnect(); } }); diff --git a/wallet/core/simple_transaction.cpp b/wallet/core/simple_transaction.cpp index 45f1082df..30b77d39a 100644 --- a/wallet/core/simple_transaction.cpp +++ b/wallet/core/simple_transaction.cpp @@ -108,7 +108,7 @@ namespace beam::wallet } else { - LOG_INFO() << m_Tx.GetTxID() << " Transaction accepted. Kernel: " << GetKernelIDString(); + BEAM_LOG_INFO() << m_Tx.GetTxID() << " Transaction accepted. Kernel: " << GetKernelIDString(); } m_Tx.SendTxParametersStrict(std::move(msg)); @@ -244,7 +244,7 @@ namespace beam::wallet Height maxResponseHeight = 0; if (GetParameter(TxParameterID::PeerResponseHeight, maxResponseHeight)) { - LOG_INFO() << GetTxID() << " Max height for response: " << maxResponseHeight; + BEAM_LOG_INFO() << GetTxID() << " Max height for response: " << maxResponseHeight; } } else @@ -290,7 +290,7 @@ namespace beam::wallet if (hasEndpoints) ss << ", my EP: " << std::to_base58(myEndpoint) << ", peer EP: " << std::to_base58(peerEndpoint); - LOG_INFO() << ss.str(); + BEAM_LOG_INFO() << ss.str(); builder.SaveCoins(); } diff --git a/wallet/core/wallet.cpp b/wallet/core/wallet.cpp index afd4d40a8..7c02cd354 100644 --- a/wallet/core/wallet.cpp +++ b/wallet/core/wallet.cpp @@ -56,7 +56,7 @@ namespace beam::wallet if (!isInternalSource && !tx->IsTxParameterExternalSettable(p.first, subTxID)) { - LOG_WARNING() << tx->GetTxID() << "Attempt to set internal tx parameter: " << static_cast(p.first); + BEAM_LOG_WARNING() << tx->GetTxID() << "Attempt to set internal tx parameter: " << static_cast(p.first); continue; } @@ -89,7 +89,7 @@ namespace beam::wallet { if (receiverAddr->isOwn() && receiverAddr->isExpired()) { - LOG_ERROR() << "Can't send to the expired address."; + BEAM_LOG_ERROR() << "Can't send to the expired address."; throw ReceiverAddressExpiredException(); } @@ -377,7 +377,7 @@ namespace beam::wallet { if (m_AsyncUpdateCounter == 0) { - LOG_VERBOSE() << "Async update started!"; + BEAM_LOG_VERBOSE() << "Async update started!"; } ++m_AsyncUpdateCounter; } @@ -386,7 +386,7 @@ namespace beam::wallet { if (--m_AsyncUpdateCounter == 0) { - LOG_VERBOSE() << "Async update finished!"; + BEAM_LOG_VERBOSE() << "Async update finished!"; if (m_UpdateCompleted) { m_UpdateCompleted(); @@ -533,7 +533,7 @@ namespace beam::wallet pVal->m_Msg.m_ID = kernelID; if (PostReqUnique(*pVal)) - LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for kernel: " << pVal->m_Msg.m_ID; + BEAM_LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for kernel: " << pVal->m_Msg.m_ID; } } @@ -545,7 +545,7 @@ namespace beam::wallet if (PostReq(*pVal)) { - LOG_INFO() << " Get proof for kernel: " << kernelID; + BEAM_LOG_INFO() << " Get proof for kernel: " << kernelID; } } @@ -559,7 +559,7 @@ namespace beam::wallet if (PostReqUnique(*pVal)) { - LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for asset with the owner ID: " << ownerID; + BEAM_LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for asset with the owner ID: " << ownerID; } } @@ -573,7 +573,7 @@ namespace beam::wallet if (PostReqUnique(*pVal)) { - LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for asset with id: " << assetId; + BEAM_LOG_INFO() << txID << "[" << subTxID << "]" << " Get proof for asset with id: " << assetId; } } @@ -587,7 +587,7 @@ namespace beam::wallet if (PostReqUnique(*pVal)) { - LOG_INFO() << "Get proof for asset with id: " << assetId; + BEAM_LOG_INFO() << "Get proof for asset with id: " << assetId; } } @@ -608,7 +608,7 @@ namespace beam::wallet if (PostReqUnique(*pVal)) { - LOG_INFO() << txID << "[" << subTxID << "]" << " Get details for kernel: " << msg.m_ID; + BEAM_LOG_INFO() << txID << "[" << subTxID << "]" << " Get details for kernel: " << msg.m_ID; } } } @@ -640,7 +640,7 @@ namespace beam::wallet if (PostReq(*pVal)) { - LOG_INFO() << txId << " Get shielded list, start_index = " << startIndex << ", count = " << count; + BEAM_LOG_INFO() << txId << " Get shielded list, start_index = " << startIndex << ", count = " << count; } } @@ -654,7 +654,7 @@ namespace beam::wallet if (PostReqUnique(*pVal)) { - LOG_INFO() << txId << " Get proof of shielded output."; + BEAM_LOG_INFO() << txId << " Get proof of shielded output."; } } @@ -767,7 +767,7 @@ namespace beam::wallet if (!pKeyKeeper // We can generate the ticket with OwnerKey, but can't sign it. || !CanDetectCoins()) // The wallet has no ability to recognize received shielded coin { - LOG_ERROR() << "Cannot send voucher" << TRACE(pKeyKeeper) << TRACE(CanDetectCoins()); + BEAM_LOG_ERROR() << "Cannot send voucher" << TRACE(pKeyKeeper) << TRACE(CanDetectCoins()); FailVoucherRequest(msg.m_From, myID); return; } @@ -777,7 +777,7 @@ namespace beam::wallet if (!nCount) { - LOG_ERROR() << "Cannot send voucher" << TRACE(nCount); + BEAM_LOG_ERROR() << "Cannot send voucher" << TRACE(nCount); FailVoucherRequest(msg.m_From, myID); return; //?! } @@ -804,7 +804,7 @@ namespace beam::wallet msg.GetParameter(TxParameterID::ShieldedVoucherList, res); if (res.empty()) { - LOG_WARNING() << "Received an empty voucher list"; + BEAM_LOG_WARNING() << "Received an empty voucher list"; FailTxWaitingForVouchers(msg.m_From); return; } @@ -812,14 +812,14 @@ namespace beam::wallet auto address = m_WalletDB->getAddress(msg.m_From); if (!address.is_initialized()) { - LOG_WARNING() << "Received vouchers for unknown address: " << std::to_string(msg.m_From); + BEAM_LOG_WARNING() << "Received vouchers for unknown address: " << std::to_string(msg.m_From); FailTxWaitingForVouchers(msg.m_From); return; } if (!IsValidVoucherList(res, address->m_Endpoint)) { - LOG_WARNING() << "Invalid voucher list received"; + BEAM_LOG_WARNING() << "Invalid voucher list received"; FailTxWaitingForVouchers(msg.m_From); return; } @@ -930,7 +930,7 @@ namespace beam::wallet } catch (const std::exception& exc) { - LOG_WARNING() << "Special msg failed: " << exc.what(); + BEAM_LOG_WARNING() << "Special msg failed: " << exc.what(); } } else @@ -943,7 +943,7 @@ namespace beam::wallet { LOG_DEBUG() << r.m_TxID << "[" << r.m_SubTxID << "]" << " register status " << static_cast(r.m_Res.m_Value); if (!r.m_Res.m_ExtraInfo.empty()) - LOG_WARNING() << "Extra info: " << r.m_Res.m_ExtraInfo; + BEAM_LOG_WARNING() << "Extra info: " << r.m_Res.m_ExtraInfo; auto it = m_ActiveTransactions.find(r.m_TxID); if (it != m_ActiveTransactions.end()) @@ -966,7 +966,7 @@ namespace beam::wallet void Wallet::CancelTransaction(const TxID& txId) { - LOG_INFO() << txId << " Canceling tx"; + BEAM_LOG_INFO() << txId << " Canceling tx"; if (auto it = m_ActiveTransactions.find(txId); it != m_ActiveTransactions.end()) { @@ -974,20 +974,20 @@ namespace beam::wallet } else { - LOG_WARNING() << "Transaction already inactive"; + BEAM_LOG_WARNING() << "Transaction already inactive"; } } void Wallet::DeleteTransaction(const TxID& txId) { - LOG_INFO() << "deleting tx " << txId; + BEAM_LOG_INFO() << "deleting tx " << txId; if (auto it = m_ActiveTransactions.find(txId); it == m_ActiveTransactions.end()) { m_WalletDB->deleteTx(txId); } else { - LOG_WARNING() << "Cannot delete running transaction"; + BEAM_LOG_WARNING() << "Cannot delete running transaction"; } } @@ -1154,7 +1154,7 @@ namespace beam::wallet void Wallet::ProcessAssetInfo(const Asset::Full& info, Height height, const std::string& logPrefix) { m_WalletDB->saveAsset(info, height); - LOG_INFO() << logPrefix << (logPrefix.empty() ? "" : " ") << "Received proof for Asset with ID " << info.m_ID; + BEAM_LOG_INFO() << logPrefix << (logPrefix.empty() ? "" : " ") << "Received proof for Asset with ID " << info.m_ID; if (Key::IKdf::Ptr maserKdf = m_WalletDB->get_MasterKdf()) { @@ -1168,7 +1168,7 @@ namespace beam::wallet } else { - LOG_WARNING() << logPrefix << "Unable to get master key. Asset's " << info.m_ID << " ownership won't be checked."; + BEAM_LOG_WARNING() << logPrefix << "Unable to get master key. Asset's " << info.m_ID << " ownership won't be checked."; } if (const auto wasset = m_WalletDB->findAsset(info.m_ID)) @@ -1693,7 +1693,7 @@ namespace beam::wallet std::copy_n(data->m_TxID.m_pData, sizeof(TxID), c.m_createTxId->begin()); } - LOG_INFO() << "CoinID: " << c.m_ID << " Maturity=" << hMaturity << (bAdd ? " Confirmed" : " Spent") << ", Height=" << h; + BEAM_LOG_INFO() << "CoinID: " << c.m_ID << " Maturity=" << hMaturity << (bAdd ? " Confirmed" : " Spent") << ", Height=" << h; if (bAdd) { @@ -1709,7 +1709,7 @@ namespace beam::wallet { c.m_status = Coin::Status::Outgoing; c.m_spentTxId = txid; - LOG_INFO() << "CoinID: " << c.m_ID << " marked as Outgoing"; + BEAM_LOG_INFO() << "CoinID: " << c.m_ID << " marked as Outgoing"; } } } @@ -1767,13 +1767,13 @@ namespace beam::wallet { shieldedCoin->m_Status = ShieldedCoin::Status::Outgoing;; shieldedCoin->m_spentTxId = txid; - LOG_INFO() << "Shielded output, ID: " << shieldedEvt.m_TxoID << " marked as Outgoing"; + BEAM_LOG_INFO() << "Shielded output, ID: " << shieldedEvt.m_TxoID << " marked as Outgoing"; } } m_WalletDB->saveShieldedCoin(*shieldedCoin); - LOG_INFO() << "Shielded output, ID: " << shieldedEvt.m_TxoID << (isAdd ? " Confirmed" : " Spent") << ", Height=" << h; + BEAM_LOG_INFO() << "Shielded output, ID: " << shieldedEvt.m_TxoID << (isAdd ? " Confirmed" : " Spent") << ", Height=" << h; RestoreTransactionFromShieldedCoin(*shieldedCoin); } @@ -1784,7 +1784,7 @@ namespace beam::wallet Block::SystemState::ID id; sTip.get_ID(id); - LOG_INFO() << "Rolled back to " << id; + BEAM_LOG_INFO() << "Rolled back to " << id; m_WalletDB->setSystemStateID(id); m_WalletDB->get_History().DeleteFrom(sTip.m_Height + 1); @@ -1862,7 +1862,7 @@ namespace beam::wallet if (bHashChanged || (h != hh.m_Height)) { - LOG_INFO() << "Events Serif changed: " << (bHashChanged ? "new Hash, " : "") << "Height=" << h << (bMustRescan ? ", Resyncing" : ""); + BEAM_LOG_INFO() << "Events Serif changed: " << (bHashChanged ? "new Hash, " : "") << "Height=" << h << (bMustRescan ? ", Resyncing" : ""); hh.m_Height = h; storage::setVar(*m_WalletDB, szEvtSerif, hh); @@ -1884,7 +1884,7 @@ namespace beam::wallet for (uint32_t i = 0; i < nCount; i++) os << "\n\t" << pHv[i]; - LOG_INFO() << os.str(); + BEAM_LOG_INFO() << os.str(); for (auto it = m_ActiveTransactions.begin(); m_ActiveTransactions.end() != it; it++) it->second->OnDependentStateChanged(); @@ -1939,7 +1939,7 @@ namespace beam::wallet Block::SystemState::ID id; sTip.get_ID(id); - LOG_INFO() << "Sync up to " << id; + BEAM_LOG_INFO() << "Sync up to " << id; if (!SyncRemains()) { @@ -1963,7 +1963,7 @@ namespace beam::wallet void Wallet::OnTipUnchanged() { - LOG_INFO() << "Tip has not been changed"; + BEAM_LOG_INFO() << "Tip has not been changed"; RequestBodies(); @@ -1979,7 +1979,7 @@ namespace beam::wallet if (!m_WalletDB->get_CommitmentSafe(pReq->m_Msg.m_Utxo, coin.m_ID)) { - LOG_WARNING() << "You cannot get utxo commitment without private key"; + BEAM_LOG_WARNING() << "You cannot get utxo commitment without private key"; return; } @@ -2039,7 +2039,7 @@ namespace beam::wallet ZeroObject(id); m_WalletDB->setSystemStateID(id); - LOG_INFO() << "Current state is " << id; + BEAM_LOG_INFO() << "Current state is " << id; NotifySyncProgress(); if (!IsValidTimeStamp(sTip.m_TimeStamp)) @@ -2107,7 +2107,7 @@ namespace beam::wallet auto done = GetSyncDone(); assert(done <= total); int p = static_cast((done * 100) / total); - LOG_INFO() << "Synchronizing with node: " << p << "% (" << done << "/" << total << ")"; + BEAM_LOG_INFO() << "Synchronizing with node: " << p << "% (" << done << "/" << total << ")"; NotifySyncProgress(); } @@ -2200,7 +2200,7 @@ namespace beam::wallet if (pTx->GetType() != msg.m_Type) { - LOG_WARNING() << msg.m_TxID << " Parameters for invalid tx type"; + BEAM_LOG_WARNING() << msg.m_TxID << " Parameters for invalid tx type"; return; } @@ -2256,7 +2256,7 @@ namespace beam::wallet { if (m_ssHandler == nullptr) { - LOG_WARNING() << "DexSimpleSwap tx is received but feature is disabled. " << "TxID is " << msg.m_TxID; + BEAM_LOG_WARNING() << "DexSimpleSwap tx is received but feature is disabled. " << "TxID is " << msg.m_TxID; return; } } @@ -2268,7 +2268,7 @@ namespace beam::wallet if (!m_ssHandler->acceptIncomingDexSS(msg)) { // TODO:DEX create tx and fail tx with rejected reason to make the peer not wait - LOG_INFO() << "Incoming DexSimpleSwap rejected. " + BEAM_LOG_INFO() << "Incoming DexSimpleSwap rejected. " << "DexOrderID [" << msg.GetParameterOrDefault(TxParameterID::ExternalDexOrderID) << "] " << "TxID " << msg.m_TxID; return; @@ -2302,13 +2302,13 @@ namespace beam::wallet if (msg.m_Type == TxType::DexSimpleSwap) { m_ssHandler->onDexTxCreated(msg, pTx); - LOG_INFO() << "Incoming DexSimpleSwap accepted. TxID is " << msg.m_TxID; + BEAM_LOG_INFO() << "Incoming DexSimpleSwap accepted. TxID is " << msg.m_TxID; } } else { assert(false); - LOG_WARNING() << "Unsupported TX Type requested via SBBS: " + BEAM_LOG_WARNING() << "Unsupported TX Type requested via SBBS: " << " type: " << static_cast(msg.m_Type) << " txid: " << msg.m_TxID; return; @@ -2320,7 +2320,7 @@ namespace beam::wallet auto it = m_TxCreators.find(type); if (it == m_TxCreators.end()) { - LOG_WARNING() << id << " Unsupported type of transaction: " << static_cast(type); + BEAM_LOG_WARNING() << id << " Unsupported type of transaction: " << static_cast(type); return wallet::BaseTransaction::Ptr(); } @@ -2338,7 +2338,7 @@ namespace beam::wallet auto it = m_TxCreators.find(*type); if (it == m_TxCreators.end()) { - LOG_ERROR() << *parameters.GetTxID() << " Unsupported type of transaction: " << static_cast(*type); + BEAM_LOG_ERROR() << *parameters.GetTxID() << " Unsupported type of transaction: " << static_cast(*type); return BaseTransaction::Ptr(); } @@ -2511,7 +2511,7 @@ namespace beam::wallet } if (!storage::setTxParameter(*m_WalletDB, id, TxParameterID::IsContractNotificationMarkedAsRead, true, true)) - LOG_ERROR() << "Can't mark application notification as read."; + BEAM_LOG_ERROR() << "Can't mark application notification as read."; } void Wallet::sendInstantSbbsMessage(beam::Timestamp timestamp, const WalletID& peerID, const WalletID& myID, ByteBuffer&& message) diff --git a/wallet/core/wallet_db.cpp b/wallet/core/wallet_db.cpp index 113201486..a6a7fbf0d 100644 --- a/wallet/core/wallet_db.cpp +++ b/wallet/core/wallet_db.cpp @@ -1734,7 +1734,7 @@ namespace beam::wallet for (const auto& updateInfo: updates) { storage::setTxParameter(*walletDB, updateInfo.txID, static_cast(updateInfo.subTxID), TxParameterID::ExchangeRates, updateInfo.rates, false); - LOG_INFO() << "Rates convert for " << updateInfo.txID << ", rcnt: " << updateInfo.rates.size(); + BEAM_LOG_INFO() << "Rates convert for " << updateInfo.txID << ", rcnt: " << updateInfo.rates.size(); } } @@ -1753,7 +1753,7 @@ namespace beam::wallet } else { - LOG_WARNING() << "MigrateTransactionsFrom30: Unexpected tx without TxID"; + BEAM_LOG_WARNING() << "MigrateTransactionsFrom30: Unexpected tx without TxID"; assert(false); } return true; @@ -1791,7 +1791,7 @@ namespace beam::wallet ret = checkKey(); if (ret != SQLITE_OK) { - LOG_INFO() << "Applying PRAGMA cipher_migrate..."; + BEAM_LOG_INFO() << "Applying PRAGMA cipher_migrate..."; ret = sqlite3_close(*db); throwIfError(ret, *db); ret = sqlite3_open_v2(path.c_str(), db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr); @@ -1810,7 +1810,7 @@ namespace beam::wallet if (!storage::getVar(db, WalletSeed, seed.V)) { assert(false && "there is no seed for walletDB"); - LOG_ERROR() << "there is no seed for walletDB"; + BEAM_LOG_ERROR() << "there is no seed for walletDB"; return false; } db.setPrivateVarRaw(WalletSeed, &seed.V, sizeof(seed.V)); @@ -1865,7 +1865,7 @@ namespace beam::wallet { if (seed.V != seed2.V) { - LOG_ERROR() << "Public database has different master key. Please check your \'wallet.db\' and \'wallet.db.private\'"; + BEAM_LOG_ERROR() << "Public database has different master key. Please check your \'wallet.db\' and \'wallet.db.private\'"; return false; } } @@ -1926,7 +1926,7 @@ namespace beam::wallet { if (isInitialized(path)) { - LOG_ERROR() << path << " already exists."; + BEAM_LOG_ERROR() << path << " already exists."; throw DatabaseException("Database already exists"); } @@ -2205,7 +2205,7 @@ namespace beam::wallet { if (!isInitialized(path)) { - LOG_ERROR() << path << " not found, please init the wallet before."; + BEAM_LOG_ERROR() << path << " not found, please init the wallet before."; throw DatabaseNotFoundException(); } @@ -2241,7 +2241,7 @@ namespace beam::wallet case DbVersion11: case DbVersion12: { - LOG_INFO() << "Converting DB from format 10-11"; + BEAM_LOG_INFO() << "Converting DB from format 10-11"; // storage table changes: removed [status], [createHeight], [lockedHeight], added [spentHeight] // sqlite doesn't support column removal. So instead we'll rename this table, select the data, and insert it to the new table @@ -2327,7 +2327,7 @@ namespace beam::wallet // no break; case DbVersion13: - LOG_INFO() << "Converting DB to format 13..."; + BEAM_LOG_INFO() << "Converting DB to format 13..."; CreateWalletMessageTable(walletDB->_db); CreatePrivateVariablesTable(walletDB->m_PrivateDB); @@ -2339,7 +2339,7 @@ namespace beam::wallet case DbVersion14: { - LOG_INFO() << "Converting DB from format 14..."; + BEAM_LOG_INFO() << "Converting DB from format 14..."; // tx_params table changed: added new column [subTxID] // move old data to temp table @@ -2370,23 +2370,23 @@ namespace beam::wallet // no break; case DbVersion15: - LOG_INFO() << "Converting DB from format 15..."; + BEAM_LOG_INFO() << "Converting DB from format 15..."; // originally there was a coin migration, because "assetId" column was added. // We now postpone this migration till 18-19, where the "assetId" column was moved into an index. // no break; case DbVersion16: - LOG_INFO() << "Converting DB from format 16..."; + BEAM_LOG_INFO() << "Converting DB from format 16..."; CreateLaserTables(walletDB->_db); // no break; case DbVersion17: - LOG_INFO() << "Converting DB from format 17..."; + BEAM_LOG_INFO() << "Converting DB from format 17..."; CreateAssetsTable(walletDB->_db); // no break case DbVersion18: - LOG_INFO() << "Converting DB from format 18..."; + BEAM_LOG_INFO() << "Converting DB from format 18..."; walletDB->MigrateCoins(); CreateNotificationsTable(walletDB->_db); CreateExchangeRatesTable29(walletDB->_db); @@ -2394,17 +2394,17 @@ namespace beam::wallet // no break case DbVersion19: - LOG_INFO() << "Converting DB from format 19..."; + BEAM_LOG_INFO() << "Converting DB from format 19..."; CreateShieldedCoinsTable(walletDB->_db); // no break case DbVersion20: - LOG_INFO() << "Converting DB from format 20..."; + BEAM_LOG_INFO() << "Converting DB from format 20..."; MigrateAssetsFrom20(walletDB->_db); // no break case DbVersion21: - LOG_INFO() << "Converting DB from format 21..."; + BEAM_LOG_INFO() << "Converting DB from format 21..."; CreateVouchersTable(db); // no break @@ -2413,7 +2413,7 @@ namespace beam::wallet // no break case DbVersion23: - LOG_INFO() << "Converting DB from format 23..."; + BEAM_LOG_INFO() << "Converting DB from format 23..."; if (!VouchersHasFlags(walletDB.get())) { AddVouchersFlagsColumn(db); @@ -2421,69 +2421,69 @@ namespace beam::wallet // no break case DbVersion24: - LOG_INFO() << "Converting DB from format 24..."; + BEAM_LOG_INFO() << "Converting DB from format 24..."; MigrateAddressesFrom24(walletDB.get(), walletDB->_db); // no break case DbVersion25: - LOG_INFO() << "Converting DB from format 25..."; + BEAM_LOG_INFO() << "Converting DB from format 25..."; CreateExchangeRatesHistoryTable29(walletDB->_db); // no break case DbVersion26: - LOG_INFO() << "Converting DB from format 26..."; + BEAM_LOG_INFO() << "Converting DB from format 26..."; MigrateTransactionsFrom26(walletDB.get()); // no break case DbVersion27: - LOG_INFO() << "Converting DB from format 27..."; + BEAM_LOG_INFO() << "Converting DB from format 27..."; CreateTxSummaryTable(walletDB->_db); walletDB->FillTxSummaryTable(); // no break case DbVersion28: - LOG_INFO() << "Converting DB from format 28..."; + BEAM_LOG_INFO() << "Converting DB from format 28..."; CreateEventsTable(walletDB->_db); // no break case DbVersion29: - LOG_INFO() << "Converting DB from format 29..."; + BEAM_LOG_INFO() << "Converting DB from format 29..."; MigrateRatesFrom29(walletDB.get(), walletDB->_db); MigrateRatesHistoryFrom29(walletDB.get(), walletDB->_db); MigrateTxRatesFrom29to30(walletDB.get(), walletDB->_db); // no break case DbVersion30: - LOG_INFO() << "Converting DB from format 30..."; + BEAM_LOG_INFO() << "Converting DB from format 30..."; MigrateTransactionsFrom30(walletDB.get(), walletDB->_db); // no break case DbVersion31: - LOG_INFO() << "Converting DB from format 31..."; + BEAM_LOG_INFO() << "Converting DB from format 31..."; MigrateFrom31(walletDB.get(), walletDB->_db); // no break case DbVersion32: - LOG_INFO() << "Converting DB from format 32..."; + BEAM_LOG_INFO() << "Converting DB from format 32..."; MigrateFrom32(walletDB->_db); case DbVersion33: - LOG_INFO() << "Converting DB from format 33..."; + BEAM_LOG_INFO() << "Converting DB from format 33..."; CreateDexOffersTable(walletDB->_db); // no break case DbVersion34: - LOG_INFO() << "Converting DB from format 34..."; + BEAM_LOG_INFO() << "Converting DB from format 34..."; CreateIMTables(walletDB->_db); // no break case DbVersion35: - LOG_INFO() << "Converting DB from format 35..."; + BEAM_LOG_INFO() << "Converting DB from format 35..."; walletDB->DeleteNonceAddresses(); // no break case DbVersion36: - LOG_INFO() << "Converting DB from format 36..."; + BEAM_LOG_INFO() << "Converting DB from format 36..."; DeleteIMTables(walletDB->_db); CreateIMTables(walletDB->_db); // no break @@ -2510,7 +2510,7 @@ namespace beam::wallet } catch (std::runtime_error& err) { - LOG_ERROR() << "Database migration failed: " << err.what(); + BEAM_LOG_ERROR() << "Database migration failed: " << err.what(); walletDB->rollbackDB(); throw DatabaseMigrationException(); } @@ -2676,7 +2676,7 @@ namespace beam::wallet } catch (const runtime_error& ex) { - LOG_ERROR() << "Wallet DB Commit failed: " << ex.what(); + BEAM_LOG_ERROR() << "Wallet DB Commit failed: " << ex.what(); } m_DbTransaction.reset(); } @@ -2893,7 +2893,7 @@ namespace beam::wallet c.m_maturity = outp.get_MinMaturity(h); c.m_confirmHeight = h; - LOG_INFO() << "CoinID: " << c.m_ID << " Maturity=" << c.m_maturity << " Recovered"; + BEAM_LOG_INFO() << "CoinID: " << c.m_ID << " Maturity=" << c.m_maturity << " Recovered"; m_This.saveCoin(c); @@ -2937,7 +2937,7 @@ namespace beam::wallet m_This.saveShieldedCoin(sc); - LOG_INFO() << "Shielded output, ID: " << dout.m_ID << " Confirmed, Height=" << dout.m_Height; + BEAM_LOG_INFO() << "Shielded output, ID: " << dout.m_ID << " Confirmed, Height=" << dout.m_Height; m_mapShielded[pars.m_Ticket.m_SpendPk] = sc.m_CoinID.m_Key; @@ -2957,7 +2957,7 @@ namespace beam::wallet shieldedCoin->m_spentHeight = dinp.m_Height; m_This.saveShieldedCoin(*shieldedCoin); - LOG_INFO() << "Shielded input, TxoID: " << shieldedCoin->m_TxoID << " Spent, Height=" << dinp.m_Height; + BEAM_LOG_INFO() << "Shielded input, TxoID: " << shieldedCoin->m_TxoID << " Spent, Height=" << dinp.m_Height; } m_mapShielded.erase(it); @@ -3033,14 +3033,14 @@ namespace beam::wallet get_Endpoint(addr.m_Endpoint, addr.m_OwnID); setDefaultToken(addr); - LOG_INFO() << boost::format(kWalletAddrNewGenerated) % addr.m_Token; + BEAM_LOG_INFO() << boost::format(kWalletAddrNewGenerated) % addr.m_Token; if (addr.m_Endpoint != Zero) { - LOG_INFO() << boost::format(kAddrNewGeneratedEndpoint) % std::to_base58(addr.m_Endpoint); + BEAM_LOG_INFO() << boost::format(kAddrNewGeneratedEndpoint) % std::to_base58(addr.m_Endpoint); } if (!addr.m_label.empty()) { - LOG_INFO() << boost::format(kAddrNewGeneratedLabel) % addr.m_label; + BEAM_LOG_INFO() << boost::format(kAddrNewGeneratedLabel) % addr.m_label; } } @@ -4949,7 +4949,7 @@ namespace beam::wallet bool WalletDB::removeLaserChannel( const std::shared_ptr>& chId) { - LOG_INFO() << "Removing channel: " + BEAM_LOG_INFO() << "Removing channel: " << to_hex(chId->m_pData, chId->nBytes); const char* selectReq = "SELECT chID, myWID FROM " LASER_CHANNELS_NAME " WHERE chID=?1;"; @@ -5993,7 +5993,7 @@ namespace beam::wallet continue; // not a nonce, used in multiple txs deleteAddress(addr.m_BbsAddr); - LOG_INFO() << "Removed nonce addr: " << addr.m_Token; + BEAM_LOG_INFO() << "Removed nonce addr: " << addr.m_Token; } } @@ -6119,7 +6119,7 @@ namespace beam::wallet if (!address.is_initialized()) { - LOG_INFO() << "Address " << to_string(walletID) << "is absent in wallet"; + BEAM_LOG_INFO() << "Address " << to_string(walletID) << "is absent in wallet"; return false; } @@ -6713,12 +6713,12 @@ namespace beam::wallet } db.saveAddress(address); - LOG_INFO() << "The address [" << jsonAddress[Fields::BbsAddr] << "] has been successfully imported."; + BEAM_LOG_INFO() << "The address [" << jsonAddress[Fields::BbsAddr] << "] has been successfully imported."; continue; } } - LOG_INFO() << "The address [" << jsonAddress[Fields::BbsAddr] << "] has NOT been imported. Wrong address."; + BEAM_LOG_INFO() << "The address [" << jsonAddress[Fields::BbsAddr] << "] has NOT been imported. Wrong address."; return false; } return true; @@ -6768,7 +6768,7 @@ namespace beam::wallet auto itype = paramsMap.find(TxParameterID::TransactionType); if(itype == paramsMap.end()) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. No txtype parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. No txtype parameter"; ++errorsCount; continue; } @@ -6776,7 +6776,7 @@ namespace beam::wallet TxType txtype = TxType::Simple; if (!fromByteBuffer(itype->second.m_value, txtype)) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Failed to read txtype parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Failed to read txtype parameter"; ++errorsCount; continue; } @@ -6784,7 +6784,7 @@ namespace beam::wallet WalletID wid(Zero); if (auto idIt = paramsMap.find(TxParameterID::MyAddr); idIt != paramsMap.end() && !wid.FromBuf(idIt->second.m_value)) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid myID parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid myID parameter"; ++errorsCount; continue; } @@ -6798,7 +6798,7 @@ namespace beam::wallet // Should be Zero for assets issue & consume if (wid != Zero) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Nonzero MyID for asset issue/consume/lelanutus"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Nonzero MyID for asset issue/consume/lelanutus"; ++errorsCount; continue; } @@ -6807,7 +6807,7 @@ namespace beam::wallet { if (wid != Zero && !wid.IsValid()) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid myID parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid myID parameter"; ++errorsCount; continue; } @@ -6815,7 +6815,7 @@ namespace beam::wallet auto waddr = db.getAddress(wid); if (waddr && (!waddr->isOwn() || !db.ValidateSbbsWalletID(wid, waddr->m_OwnID))) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid address parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid address parameter"; ++errorsCount; continue; } @@ -6825,14 +6825,14 @@ namespace beam::wallet if (addressIt != paramsMap.end() && (!fromByteBuffer(addressIt->second.m_value, myAddrId) || !db.ValidateSbbsWalletID(wid, myAddrId))) { - LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid MyAddressID parameter"; + BEAM_LOG_ERROR() << "Transaction " << txPair.first << " was not imported. Invalid MyAddressID parameter"; ++errorsCount; continue; } if (!waddr && addressIt == paramsMap.end()) { - LOG_WARNING() << "Transaction " << txPair.first << ". Cannot check imported address"; + BEAM_LOG_WARNING() << "Transaction " << txPair.first << ". Cannot check imported address"; } } @@ -6845,7 +6845,7 @@ namespace beam::wallet p.m_value, false); } - LOG_INFO() << "Transaction " << txPair.first << " was imported."; + BEAM_LOG_INFO() << "Transaction " << txPair.first << " was imported."; } return errorsCount == 0; } @@ -6907,7 +6907,7 @@ namespace beam::wallet { if (params.find(mp) == params.end()) { - LOG_WARNING() << "Transaction " << tx << " doesn't have mandatory parameters" << (int)mp << ". Skipping it"; + BEAM_LOG_WARNING() << "Transaction " << tx << " doesn't have mandatory parameters" << (int)mp << ". Skipping it"; canExport = false; break; } @@ -6960,7 +6960,7 @@ namespace beam::wallet } catch (const nlohmann::detail::exception& e) { - LOG_ERROR() << "json parse: " << e.what() << "\n" << std::string(data, data + (size > 1024 ? 1024 : size)); + BEAM_LOG_ERROR() << "json parse: " << e.what() << "\n" << std::string(data, data + (size > 1024 ? 1024 : size)); } return false; } @@ -7156,7 +7156,7 @@ namespace beam::wallet } else { - LOG_WARNING() << "No payment confirmation for the specified transaction."; + BEAM_LOG_WARNING() << "No payment confirmation for the specified transaction."; } return ByteBuffer(); @@ -7213,7 +7213,7 @@ namespace beam::wallet } else { - LOG_WARNING() << "No payment confirmation for the specified transaction."; + BEAM_LOG_WARNING() << "No payment confirmation for the specified transaction."; } return ByteBuffer(); @@ -7248,7 +7248,7 @@ namespace beam::wallet TxType txType = TxType::Simple; if (!storage::getTxParameter(walletDB, txID, TxParameterID::TransactionType, txType)) { - LOG_ERROR() << "There is no transaction with given ID."; + BEAM_LOG_ERROR() << "There is no transaction with given ID."; return {}; } switch (txType) @@ -7258,7 +7258,7 @@ namespace beam::wallet case TxType::PushTransaction: return ExportShieldedPaymentProof(walletDB, txID); default: - LOG_WARNING() << "Cannot provide payment proof for this transaction type: " << (int)txType; + BEAM_LOG_WARNING() << "Cannot provide payment proof for this transaction type: " << (int)txType; } return ByteBuffer(); @@ -7290,7 +7290,7 @@ namespace beam::wallet { void LogSqliteError(void* pArg, int iErrCode, const char* zMsg) { - LOG_ERROR() << "(" << iErrCode << ") " << zMsg; + BEAM_LOG_ERROR() << "(" << iErrCode << ") " << zMsg; } } @@ -7695,35 +7695,35 @@ namespace beam::wallet case TokenType::Public: { auto token = GeneratePublicToken(address, *walletDB, ""); - LOG_INFO() << "Generated public offline address: " << token; + BEAM_LOG_INFO() << "Generated public offline address: " << token; return token; } case TokenType::RegularOldStyle: { auto token = GenerateRegularOldToken(address); - LOG_INFO() << "Generated regular old style address: " << token; + BEAM_LOG_INFO() << "Generated regular old style address: " << token; return token; } case TokenType::RegularNewStyle: { auto token = GenerateRegularNewToken(address, 0, 0, ""); - LOG_INFO() << "Generated regular new style address:" << token; + BEAM_LOG_INFO() << "Generated regular new style address:" << token; return token; } case TokenType::Offline: { auto token = GenerateOfflineToken(address, *walletDB, 0, 0, "", offlineCount); - LOG_INFO() << "Generated offline address: " << token; + BEAM_LOG_INFO() << "Generated offline address: " << token; return token; } case TokenType::MaxPrivacy: { auto token = GenerateMaxPrivacyToken(address, *walletDB, 0, 0, ""); - LOG_INFO() << "Generated max privacy address: " << token; + BEAM_LOG_INFO() << "Generated max privacy address: " << token; return token; } diff --git a/wallet/core/wallet_network.cpp b/wallet/core/wallet_network.cpp index 07864daef..dd55dc510 100644 --- a/wallet/core/wallet_network.cpp +++ b/wallet/core/wallet_network.cpp @@ -101,7 +101,7 @@ namespace beam::wallet { bValid = true; } catch (const std::exception&) { - LOG_WARNING() << "BBS deserialization failed"; + BEAM_LOG_WARNING() << "BBS deserialization failed"; } if (bValid) @@ -155,7 +155,7 @@ namespace beam::wallet { pAddr->m_Refs |= Addr::s_InternalRef; pAddr->m_ExpirationTime = address.getExpirationTime(); - LOG_INFO() << "WalletID " << to_string(address.m_BbsAddr) << " subscribes to BBS channel " << pAddr->m_Channel.m_Value; + BEAM_LOG_INFO() << "WalletID " << to_string(address.m_BbsAddr) << " subscribes to BBS channel " << pAddr->m_Channel.m_Value; } void BaseMessageEndpoint::DeleteOwnAddress(const WalletID& wid) @@ -239,7 +239,7 @@ namespace beam::wallet { } else { - LOG_WARNING() << "BBS serialization failed (bad peerID?)"; + BEAM_LOG_WARNING() << "BBS serialization failed (bad peerID?)"; } } @@ -356,11 +356,11 @@ namespace beam::wallet { } catch (const std::exception & e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } @@ -508,11 +508,11 @@ namespace beam::wallet { } catch (const std::exception& e) { - LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); + BEAM_LOG_UNHANDLED_EXCEPTION() << "what = " << e.what(); } catch (...) { - LOG_UNHANDLED_EXCEPTION(); + BEAM_LOG_UNHANDLED_EXCEPTION(); } } diff --git a/wallet/ipfs/ipfs_imp.cpp b/wallet/ipfs/ipfs_imp.cpp index 5178dd654..edfc62390 100644 --- a/wallet/ipfs/ipfs_imp.cpp +++ b/wallet/ipfs/ipfs_imp.cpp @@ -66,9 +66,9 @@ namespace beam::wallet::imp } config.repo_root = canonicalPath.string(); - LOG_INFO() << "Starting IPFS Service. Repo path is " << config.repo_root; + BEAM_LOG_INFO() << "Starting IPFS Service. Repo path is " << config.repo_root; asio_ipfs::node::redirect_logs([] (const char* what) { - LOG_INFO() << what; + BEAM_LOG_INFO() << what; }); // @@ -86,14 +86,14 @@ namespace beam::wallet::imp { case Rules::Network::dappnet: config.bootstrap.emplace_back("/ip4/3.16.160.95/tcp/38041/p2p/12D3KooWEFuqCDtMx5TQkQ4zHd4q38Ad4iE9zuCw6qGffah9WjEo"); - LOG_INFO() << "Default DAPPNET IPFS bootstrap is used"; + BEAM_LOG_INFO() << "Default DAPPNET IPFS bootstrap is used"; break; case Rules::Network::testnet: config.bootstrap.emplace_back("/dns4/eu-node01.testnet.beam.mw/tcp/38041/p2p/12D3KooWFEa2QaN5t3oTGurg1Fz5BkoE3ueHV18WxjHCXY16hHYM"); config.bootstrap.emplace_back("/dns4/eu-node02.testnet.beam.mw/tcp/38041/p2p/12D3KooWPrfHKa3Sc7qF96biwqy1JPRVDxoVhbxFtnfnbZQXVw8e"); config.bootstrap.emplace_back("/dns4/eu-node03.testnet.beam.mw/tcp/38041/p2p/12D3KooWF1oX1FP3chGQgzosCdNqBwSb37BPhM2fQJYiYMtGpHXt"); - LOG_INFO() << "Default TESTNET IPFS bootstrap is used"; + BEAM_LOG_INFO() << "Default TESTNET IPFS bootstrap is used"; break; case Rules::Network::mainnet: @@ -101,18 +101,18 @@ namespace beam::wallet::imp config.bootstrap.emplace_back("/dns4/eu-node02.mainnet.beam.mw/tcp/38041/p2p/12D3KooWCjmtegxdSkkfutWqty39dwhEhYDWCDj6KCizDtft3sqc"); config.bootstrap.emplace_back("/dns4/eu-node03.mainnet.beam.mw/tcp/38041/p2p/12D3KooWL5c6JHHkfYLzBjcuot27eyKVhhczvvY617v1cy7QVUHt"); config.bootstrap.emplace_back("/dns4/eu-node04.mainnet.beam.mw/tcp/38041/p2p/12D3KooWHpgKQYXJMKXQZuwbuRoFK28cQLiVjCVFxhSpFX9XHNWZ"); - LOG_INFO() << "Default MAINNET IPFS bootstrap is used"; + BEAM_LOG_INFO() << "Default MAINNET IPFS bootstrap is used"; break; case Rules::Network::masternet: config.bootstrap.emplace_back("/ip4/3.19.32.148/tcp/38041/p2p/12D3KooWFrigFK9gVvCr7YDNNAAxDxmeyLDtR1tYvHcaXxuCcKpt"); - LOG_INFO() << "Default MASTERNET IPFS bootstrap is used"; + BEAM_LOG_INFO() << "Default MASTERNET IPFS bootstrap is used"; } } else { - LOG_INFO() << "Custom IPFS bootstrap is provided"; + BEAM_LOG_INFO() << "Custom IPFS bootstrap is provided"; } if (config.peering.empty()) @@ -121,30 +121,30 @@ namespace beam::wallet::imp { case Rules::Network::dappnet: config.peering.emplace_back("/ip4/3.16.160.95/tcp/38041/p2p/12D3KooWEFuqCDtMx5TQkQ4zHd4q38Ad4iE9zuCw6qGffah9WjEo"); - LOG_INFO() << "Default DAPPNET IPFS peering is used"; + BEAM_LOG_INFO() << "Default DAPPNET IPFS peering is used"; break; case Rules::Network::testnet: config.peering.emplace_back("/dns4/eu-node01.testnet.beam.mw/tcp/38041/p2p/12D3KooWFEa2QaN5t3oTGurg1Fz5BkoE3ueHV18WxjHCXY16hHYM"); config.peering.emplace_back("/dns4/eu-node02.testnet.beam.mw/tcp/38041/p2p/12D3KooWPrfHKa3Sc7qF96biwqy1JPRVDxoVhbxFtnfnbZQXVw8e"); config.peering.emplace_back("/dns4/eu-node03.testnet.beam.mw/tcp/38041/p2p/12D3KooWF1oX1FP3chGQgzosCdNqBwSb37BPhM2fQJYiYMtGpHXt"); - LOG_INFO() << "Default TESTNET IPFS peering is used"; + BEAM_LOG_INFO() << "Default TESTNET IPFS peering is used"; break; case Rules::Network::mainnet: config.peering.emplace_back("/dns4/eu-node01.mainnet.beam.mw/tcp/38041/p2p/12D3KooWJFduasQPYWhw4SsoFPmnJ1PXfmHYaA9qYKvn4JKM2hND"); config.peering.emplace_back("/dns4/eu-node02.mainnet.beam.mw/tcp/38041/p2p/12D3KooWCjmtegxdSkkfutWqty39dwhEhYDWCDj6KCizDtft3sqc"); config.peering.emplace_back("/dns4/eu-node03.mainnet.beam.mw/tcp/38041/p2p/12D3KooWL5c6JHHkfYLzBjcuot27eyKVhhczvvY617v1cy7QVUHt"); config.peering.emplace_back("/dns4/eu-node04.mainnet.beam.mw/tcp/38041/p2p/12D3KooWHpgKQYXJMKXQZuwbuRoFK28cQLiVjCVFxhSpFX9XHNWZ"); - LOG_INFO() << "Default MAINNET IPFS peering is used"; + BEAM_LOG_INFO() << "Default MAINNET IPFS peering is used"; break; case Rules::Network::masternet: config.peering.emplace_back("/ip4/3.19.32.148/tcp/38041/p2p/12D3KooWFrigFK9gVvCr7YDNNAAxDxmeyLDtR1tYvHcaXxuCcKpt"); - LOG_INFO() << "Default MASTERNET IPFS peering is used"; + BEAM_LOG_INFO() << "Default MASTERNET IPFS peering is used"; break; } } else { - LOG_INFO() << "Custom IPFS peering is provided"; + BEAM_LOG_INFO() << "Custom IPFS peering is provided"; } if (config.swarm_key.empty()) @@ -153,25 +153,25 @@ namespace beam::wallet::imp { case Rules::Network::dappnet: config.swarm_key = "/key/swarm/psk/1.0.0/\n/base16/\nbf2f20636d7cd1c58c7ae6234ea056f6a673ffad71ec08af37405c4f3cbf9928"; - LOG_INFO() << "Default DAPPNET IPFS swarm key would be used"; + BEAM_LOG_INFO() << "Default DAPPNET IPFS swarm key would be used"; break; case Rules::Network::testnet: config.swarm_key = "/key/swarm/psk/1.0.0/\n/base16/\n1191aea7c9f99f679f477411d9d44f1ea0fdf5b42d995966b14a9000432f8c4a"; - LOG_INFO() << "Default TESTNET IPFS swarm key would be used"; + BEAM_LOG_INFO() << "Default TESTNET IPFS swarm key would be used"; break; case Rules::Network::mainnet: config.swarm_key = "/key/swarm/psk/1.0.0/\n/base16/\n1fabcf9eb018710a93a85214809b91a78b8ef5c49f84a5f72da3dff587b0aed5"; - LOG_INFO() << "Default MAINNET IPFS swarm key would be used"; + BEAM_LOG_INFO() << "Default MAINNET IPFS swarm key would be used"; break; case Rules::Network::masternet: config.swarm_key = "/key/swarm/psk/1.0.0/\n/base16/\n18502580a0f94a74eeb1bdd651e4235d0d9139b7baf3555716bc919619bb8ac4"; - LOG_INFO() << "Default IPFS MASTERNET swarm key would be used"; + BEAM_LOG_INFO() << "Default IPFS MASTERNET swarm key would be used"; break; } } else { - LOG_INFO() << "Custom IPFS swarm_key is provided: " << config.swarm_key; + BEAM_LOG_INFO() << "Custom IPFS swarm_key is provided: " << config.swarm_key; } asio_ipfs::node::StateCB scb = [this](const std::string& error, uint32_t pcnt) { @@ -211,7 +211,7 @@ namespace beam::wallet::imp // threaded startup. Save data & spawn an infinitely running thread // _myid = _node->id(); - LOG_INFO() << "IPFS Service successfully started, ID is " << _myid; + BEAM_LOG_INFO() << "IPFS Service successfully started, ID is " << _myid; _ios_guard = std::make_unique(_ios.get_executor()); _thread = MyThread([this, repo = config.repo_root]() @@ -229,7 +229,7 @@ namespace beam::wallet::imp throw std::runtime_error("IPFS service thread already stopped"); } - LOG_INFO() << "Stopping IPFS Service..."; + BEAM_LOG_INFO() << "Stopping IPFS Service..."; _node->free(); _node.reset(); _ios_guard->reset(); @@ -238,7 +238,7 @@ namespace beam::wallet::imp assert(_thread.joinable()); _thread.join(); _ios.reset(); - LOG_INFO() << "IPFS Services stopped"; + BEAM_LOG_INFO() << "IPFS Services stopped"; } void IPFSService::AnyThread_add(std::vector&& data, bool pin, uint32_t timeout, std::function&& res, Err&& err) diff --git a/wallet/laser/channel.cpp b/wallet/laser/channel.cpp index 8540f6e0a..0907cd8b7 100644 --- a/wallet/laser/channel.cpp +++ b/wallet/laser/channel.cpp @@ -172,7 +172,7 @@ void Channel::SendPeer(Negotiator::Storage::Map&& dataOut) ser & (*m_ID); ser & Cast::Down(dataOut); - LOG_INFO() << "Send From: " << std::to_string(m_myAddr.m_BbsAddr) + BEAM_LOG_INFO() << "Send From: " << std::to_string(m_myAddr.m_BbsAddr) << " To peer: " << std::to_string(m_widTrg); proto::FlyClient::RequestBbsMsg::Ptr pReq( @@ -286,7 +286,7 @@ void Channel::OnCoin(const CoinID& cid, } pWalletDB->saveCoins(coins); - LOG_INFO() << "Coin " << cid << " " << szStatus; + BEAM_LOG_INFO() << "Coin " << cid << " " << szStatus; } const ChannelIDPtr& Channel::get_chID() const @@ -534,7 +534,7 @@ void Channel::Subscribe() get_myWID().m_Channel.Export(ch); get_Net().BbsSubscribe(ch, m_bbsTimestamp, m_upReceiver.get()); m_isSubscribed = true; - LOG_INFO() << "beam::wallet::laser::Channel WalletID: " << std::to_string(get_myWID()) << " subscribes to BBS channel: " << ch; + BEAM_LOG_INFO() << "beam::wallet::laser::Channel WalletID: " << std::to_string(get_myWID()) << " subscribes to BBS channel: " << ch; } void Channel::Unsubscribe() @@ -545,7 +545,7 @@ void Channel::Unsubscribe() m_isSubscribed = false; if (!m_lastUpdateStart && m_gracefulClose) m_lastUpdateStart = get_Tip(); - LOG_INFO() << "beam::wallet::laser::Channel WalletID: " << std::to_string(get_myWID()) << " unsubscribed from BBS channel: " << ch; + BEAM_LOG_INFO() << "beam::wallet::laser::Channel WalletID: " << std::to_string(get_myWID()) << " unsubscribed from BBS channel: " << ch; } @@ -651,7 +651,7 @@ void Channel::RestoreInternalState(const ByteBuffer& data) } catch (const std::exception&) { - LOG_ERROR() << "RestoreInternalState failed"; + BEAM_LOG_ERROR() << "RestoreInternalState failed"; } m_SendMyWid = false; diff --git a/wallet/laser/connection.cpp b/wallet/laser/connection.cpp index b11de0bd1..a9cdeded7 100644 --- a/wallet/laser/connection.cpp +++ b/wallet/laser/connection.cpp @@ -63,7 +63,7 @@ void Connection::PostRequestInternal(FlyClient::Request& r) } catch(const std::bad_cast&) { - LOG_ERROR() << "### Bbs mesage out ERROR ###"; + BEAM_LOG_ERROR() << "### Bbs mesage out ERROR ###"; } return; } diff --git a/wallet/laser/mediator.cpp b/wallet/laser/mediator.cpp index 5049aa88b..467ec1e20 100644 --- a/wallet/laser/mediator.cpp +++ b/wallet/laser/mediator.cpp @@ -179,7 +179,7 @@ void Mediator::OnMsg(const ChannelIDPtr& chID, Blob&& blob) { if (*chID != *inChID) { - LOG_ERROR() << "Unknown channel ID: " + BEAM_LOG_ERROR() << "Unknown channel ID: " << to_hex(inChID->m_pData , inChID->nBytes); return; } @@ -237,7 +237,7 @@ void Mediator::ListenClosedChannelsWithPossibleRollback() auto p_channelID = Channel::ChannelIdFromString(channelIdStr); if (!p_channelID) { - LOG_ERROR() << "Incorrect channel ID format: " << channelIdStr; + BEAM_LOG_ERROR() << "Incorrect channel ID format: " << channelIdStr; return; } auto channel = LoadChannelInternal(p_channelID); @@ -251,7 +251,7 @@ void Mediator::WaitIncoming(Amount aMy, Amount aTrg, Amount fee) { if (!IsEnoughCoinsAvailable(aMy + fee)) { - LOG_ERROR() << "Your available amount less then required."; + BEAM_LOG_ERROR() << "Your available amount less then required."; auto zeroID = std::make_shared(Zero); for (auto observer : m_observers) observer->OnOpenFailed(zeroID); @@ -316,13 +316,13 @@ bool Mediator::Serve(const std::string& channelID) auto channelIdStr = to_hex(p_channelID->m_pData, p_channelID->nBytes); if (!channel) { - LOG_ERROR() << "Unknown channel ID: " << channelIdStr; + BEAM_LOG_ERROR() << "Unknown channel ID: " << channelIdStr; return; } - LOG_INFO() << "Channel " << channelIdStr <<" valid till: " << channel->get_LockHeight(); - LOG_INFO() << "Channel " << channelIdStr <<" lock time for one side actions: " << channel->getLocktime(); - LOG_INFO() << "Channel " << channelIdStr <<" expire after: " + BEAM_LOG_INFO() << "Channel " << channelIdStr <<" valid till: " << channel->get_LockHeight(); + BEAM_LOG_INFO() << "Channel " << channelIdStr <<" lock time for one side actions: " << channel->getLocktime(); + BEAM_LOG_INFO() << "Channel " << channelIdStr <<" expire after: " << channel->get_LockHeight() + channel->getLocktime(); if (channel->get_State() == beam::Lightning::Channel::State::Expired) @@ -351,7 +351,7 @@ void Mediator::OpenChannel(Amount aMy, { if (!IsEnoughCoinsAvailable(aMy + fee)) { - LOG_ERROR() << "Your available amount less then required."; + BEAM_LOG_ERROR() << "Your available amount less then required."; auto zeroID = std::make_shared(Zero); for (auto observer : m_observers) observer->OnOpenFailed(zeroID); @@ -361,7 +361,7 @@ void Mediator::OpenChannel(Amount aMy, auto addresses = m_pWalletDB->getAddresses(true, true); if (storage::isMyAddress(addresses, receiverWalletID)) { - LOG_ERROR() << "Can't open channel on same DB as receiver"; + BEAM_LOG_ERROR() << "Can't open channel on same DB as receiver"; auto zeroID = std::make_shared(Zero); for (auto observer : m_observers) observer->OnOpenFailed(zeroID); @@ -390,14 +390,14 @@ bool Mediator::Close(const std::string& channelID) auto p_channelID = LoadChannel(channelID); if (!p_channelID) { - LOG_ERROR() << "Channel " << channelID << " restored with error"; + BEAM_LOG_ERROR() << "Channel " << channelID << " restored with error"; return false; } auto& channel = m_channels[p_channelID]; if (!channel) { - LOG_ERROR() << "Channel " << channelID << " unexpected error"; + BEAM_LOG_ERROR() << "Channel " << channelID << " unexpected error"; return false; } @@ -409,7 +409,7 @@ bool Mediator::Close(const std::string& channelID) if (channel->get_State() != Lightning::Channel::State::Open) { - LOG_ERROR() << "Previous action with channel: " << channelID + BEAM_LOG_ERROR() << "Previous action with channel: " << channelID << " is unfinished. Please, listen this channel till action complete."; return false; } @@ -427,14 +427,14 @@ bool Mediator::GracefulClose(const std::string& channelID) auto p_channelID = LoadChannel(channelID); if (!p_channelID) { - LOG_ERROR() << "Channel " << channelID << " restored with error"; + BEAM_LOG_ERROR() << "Channel " << channelID << " restored with error"; return false; } auto& channel = m_channels[p_channelID]; if (!channel) { - LOG_ERROR() << "Channel " << channelID << " unexpected error"; + BEAM_LOG_ERROR() << "Channel " << channelID << " unexpected error"; return false; } @@ -447,7 +447,7 @@ bool Mediator::GracefulClose(const std::string& channelID) if (channel->get_State() != Lightning::Channel::State::Open) { - LOG_ERROR() << "Previous action with channel: " << channelID + BEAM_LOG_ERROR() << "Previous action with channel: " << channelID << " is unfinished. Please, listen this channel till action complete."; return false; } @@ -472,7 +472,7 @@ bool Mediator::Delete(const std::string& channelID) auto p_channelID = Channel::ChannelIdFromString(channelID); if (!p_channelID) { - LOG_ERROR() << "Incorrect channel ID format: " << channelID; + BEAM_LOG_ERROR() << "Incorrect channel ID format: " << channelID; return false; } auto channel = LoadChannelInternal(p_channelID); @@ -481,13 +481,13 @@ bool Mediator::Delete(const std::string& channelID) auto state = channel->get_State(); if (!CanBeDeleted(state)) { - LOG_ERROR() << "Channel: " << channelID << " in active state now"; + BEAM_LOG_ERROR() << "Channel: " << channelID << " in active state now"; return false; } if (state == Lightning::Channel::State::Closed && !channel->IsSafeToForget()) { - LOG_ERROR() << "Channel: " << channelID << " can be rolled back"; + BEAM_LOG_ERROR() << "Channel: " << channelID << " can be rolled back"; return false; } @@ -499,11 +499,11 @@ bool Mediator::Delete(const std::string& channelID) m_channels.erase(p_channelID); if (m_pWalletDB->removeLaserChannel(p_channelID)) { - LOG_INFO() << "Channel: " << channelID << " deleted"; + BEAM_LOG_INFO() << "Channel: " << channelID << " deleted"; return true; } - LOG_INFO() << "Channel: " << channelID << " not deleted"; + BEAM_LOG_INFO() << "Channel: " << channelID << " not deleted"; return false; } @@ -541,7 +541,7 @@ bool Mediator::Transfer(Amount amount, const std::string& channelID) auto p_channelID = LoadChannel(channelID); if (!p_channelID) { - LOG_ERROR() << "Channel " << channelID << " restored with error"; + BEAM_LOG_ERROR() << "Channel " << channelID << " restored with error"; return false; } @@ -552,7 +552,7 @@ bool Mediator::Transfer(Amount amount, const std::string& channelID) auto myChannelAmount = channel->get_amountCurrentMy(); if (myChannelAmount < amount) { - LOG_ERROR() << "Transfer: " << PrintableAmount(amount, true) + BEAM_LOG_ERROR() << "Transfer: " << PrintableAmount(amount, true) << " to channel: " << channelID << " failed\n" << "My current channel balance is: " << PrintableAmount(myChannelAmount, true); @@ -580,7 +580,7 @@ bool Mediator::Transfer(Amount amount, const std::string& channelID) TransferInternal(amount, channel); }); - LOG_INFO() << "Sync in progress..."; + BEAM_LOG_INFO() << "Sync in progress..."; LOG_DEBUG() << "Transfer: " << PrintableAmount(amount, true) << " to channel: " << channelID << " is sceduled"; } @@ -594,11 +594,11 @@ bool Mediator::Transfer(Amount amount, const std::string& channelID) } else if (channel && channel->get_State() == Lightning::Channel::State::Updating) { - LOG_ERROR() << "Previous transfer for channel: " << channelID << " is not completed."; + BEAM_LOG_ERROR() << "Previous transfer for channel: " << channelID << " is not completed."; return false; } - LOG_ERROR() << "Channel " << channelID << " is not OPEN."; + BEAM_LOG_ERROR() << "Channel " << channelID << " is not OPEN."; return false; } @@ -625,34 +625,34 @@ bool Mediator::OnIncoming(const ChannelIDPtr& channelID, Amount fee; if (!dataIn.Get(fee, Lightning::Codes::Fee) || fee != m_feeAllowed) { - LOG_ERROR() << "Incoming connection with incorrect 'laser_fee' detected"; + BEAM_LOG_ERROR() << "Incoming connection with incorrect 'laser_fee' detected"; return false; } Amount aMy; if (!dataIn.Get(aMy, Lightning::Codes::ValueYours) || aMy != m_myInAllowed) { - LOG_ERROR() << "Incoming connection with incorrect 'laser_my_locked_amount' detected"; + BEAM_LOG_ERROR() << "Incoming connection with incorrect 'laser_my_locked_amount' detected"; return false; } Amount aTrg; if (!dataIn.Get(aTrg, Lightning::Codes::ValueMy) || aTrg != m_trgInAllowed) { - LOG_ERROR() << "Incoming connection with incorrect 'laser_remote_locked_amount' detected"; + BEAM_LOG_ERROR() << "Incoming connection with incorrect 'laser_remote_locked_amount' detected"; return false; } Height locktime; if (!dataIn.Get(locktime, Lightning::Codes::HLock) || locktime != m_Params.m_hLockTime) { - LOG_ERROR() << "Incoming connection with incorrect 'HLock' detected"; + BEAM_LOG_ERROR() << "Incoming connection with incorrect 'HLock' detected"; return false; } Unsubscribe(); - LOG_INFO() << "Create channel by incoming connection: " + BEAM_LOG_INFO() << "Create channel by incoming connection: " << to_hex(channelID->m_pData , channelID->nBytes); auto params = m_Params; @@ -671,20 +671,20 @@ void Mediator::OpenInternal(const ChannelIDPtr& chID, Height hOpenTxDh) auto& channel = m_channels[chID]; if (!channel) { - LOG_ERROR() << "Unknown channel ID: " << to_hex(chID->m_pData, chID->nBytes); + BEAM_LOG_ERROR() << "Unknown channel ID: " << to_hex(chID->m_pData, chID->nBytes); return; } channel->Subscribe(); if (channel->Open(hOpenTxDh)) { - LOG_INFO() << "Opening channel: " + BEAM_LOG_INFO() << "Opening channel: " << to_hex(chID->m_pData, chID->nBytes); UpdateChannelExterior(channel); return; } - LOG_ERROR() << "Opening channel " + BEAM_LOG_ERROR() << "Opening channel " << to_hex(chID->m_pData, chID->nBytes) << " fail"; channel->Unsubscribe(); @@ -709,7 +709,7 @@ void Mediator::TransferInternal(Amount amount, const Channel::Ptr& channel) { if (channel->Transfer(amount)) { - LOG_INFO() << "Transfer: " << PrintableAmount(amount, true) + BEAM_LOG_INFO() << "Transfer: " << PrintableAmount(amount, true) << " to channel: " << channelIdStr << " started"; UpdateChannelExterior(channel); @@ -717,16 +717,16 @@ void Mediator::TransferInternal(Amount amount, const Channel::Ptr& channel) } else { - LOG_ERROR() << "Transfer: " << PrintableAmount(amount, true) + BEAM_LOG_ERROR() << "Transfer: " << PrintableAmount(amount, true) << " to channel: " << channelIdStr << " failed"; } } else { - LOG_ERROR() << "You can't transfer: " << PrintableAmount(amount, true) + BEAM_LOG_ERROR() << "You can't transfer: " << PrintableAmount(amount, true) << " to channel: " << channelIdStr; - LOG_ERROR() << "Current height: " << tip.m_Height + 1 + BEAM_LOG_ERROR() << "Current height: " << tip.m_Height + 1 << " overtop channel lock height: " << channelLockHeight; } @@ -770,7 +770,7 @@ void Mediator::CloseInternal(const ChannelIDPtr& chID) channel->Subscribe(); return; } - LOG_ERROR() << "Can't close channel: " << to_hex(chID->m_pData, chID->nBytes); + BEAM_LOG_ERROR() << "Can't close channel: " << to_hex(chID->m_pData, chID->nBytes); for (auto observer : m_observers) { observer->OnCloseFailed(chID); @@ -782,7 +782,7 @@ void Mediator::ClosingCompleted(const ChannelIDPtr& p_channelID) auto it = m_channels.find(p_channelID); if (it == m_channels.end()) return; - LOG_INFO() << "ClosingCompleted: " + BEAM_LOG_INFO() << "ClosingCompleted: " << to_hex(p_channelID->m_pData, p_channelID->nBytes); m_closedChannels.push_back(std::move(it->second)); m_channels.erase(it); @@ -805,7 +805,7 @@ ChannelIDPtr Mediator::LoadChannel(const std::string& channelID) auto p_channelID = Channel::ChannelIdFromString(channelID); if (!p_channelID) { - LOG_ERROR() << "Incorrect channel ID format: " << channelID; + BEAM_LOG_ERROR() << "Incorrect channel ID format: " << channelID; return nullptr; } @@ -828,7 +828,7 @@ Channel::Ptr Mediator::LoadChannelInternal(const ChannelIDPtr& p_channelID) TLaserChannelEntity chDBEntity; if (!m_pWalletDB->getLaserChannel(p_channelID, &chDBEntity)) { - LOG_INFO() << "Channel " + BEAM_LOG_INFO() << "Channel " << to_hex(p_channelID->m_pData , p_channelID->nBytes) << " not saved in DB"; return nullptr; @@ -838,7 +838,7 @@ Channel::Ptr Mediator::LoadChannelInternal(const ChannelIDPtr& p_channelID) auto myAddr = m_pWalletDB->getAddress(myWID, true); if (!myAddr) { - LOG_ERROR() << "Can't load address from DB: " + BEAM_LOG_ERROR() << "Can't load address from DB: " << std::to_string(myWID); return nullptr; } @@ -871,7 +871,7 @@ void Mediator::UpdateChannels() bool revisionDiscarded = false; if (state == Lightning::Channel::State::Updating && channel->IsUpdateStuck()) { - LOG_WARNING() << "Update stuck, discarding last revision..."; + BEAM_LOG_WARNING() << "Update stuck, discarding last revision..."; channel->DiscardLastRevision(); revisionDiscarded = true; } @@ -879,7 +879,7 @@ void Mediator::UpdateChannels() bool closingDiscarded = false; if (state == Lightning::Channel::State::Closing1 && channel->IsGracefulCloseStuck()) { - LOG_WARNING() << "Closing stuck, discarding last revision..."; + BEAM_LOG_WARNING() << "Closing stuck, discarding last revision..."; channel->DiscardLastRevision(); closingDiscarded = true; } @@ -968,7 +968,7 @@ bool Mediator::ValidateTip() Block::SystemState::ID id; tip.get_ID(id); m_pWalletDB->setSystemStateID(id); - LOG_INFO() << "LASER Current state is " << id; + BEAM_LOG_INFO() << "LASER Current state is " << id; return true; } @@ -1006,7 +1006,7 @@ bool Mediator::IsInSync() void Mediator::ExpireChannel(const Channel::Ptr& channel) { const auto& p_channelID = channel->get_chID(); - LOG_ERROR() << "Channel ID: " + BEAM_LOG_ERROR() << "Channel ID: " << to_hex(p_channelID->m_pData, p_channelID->nBytes) << " lock height expired"; channel->LogState(); channel->UpdateRestorePoint(); diff --git a/wallet/transactions/assets/aissue_transaction.cpp b/wallet/transactions/assets/aissue_transaction.cpp index 25fe17dfa..0ac96b375 100644 --- a/wallet/transactions/assets/aissue_transaction.cpp +++ b/wallet/transactions/assets/aissue_transaction.cpp @@ -86,7 +86,7 @@ namespace beam::wallet auto& builder = *_builder; if (GetState() == State::Initial) { - LOG_INFO() + BEAM_LOG_INFO() << GetTxID() << " " << (_issue ? "Generating" : "Consuming") diff --git a/wallet/transactions/assets/aregister_transaction.cpp b/wallet/transactions/assets/aregister_transaction.cpp index 1375ea552..f2598809a 100644 --- a/wallet/transactions/assets/aregister_transaction.cpp +++ b/wallet/transactions/assets/aregister_transaction.cpp @@ -90,7 +90,7 @@ namespace beam::wallet { builder.Sign(); - LOG_INFO() << GetTxID() << " Registering asset with the owner ID " << builder.m_pKrn->CastTo_AssetCreate().m_Owner + BEAM_LOG_INFO() << GetTxID() << " Registering asset with the owner ID " << builder.m_pKrn->CastTo_AssetCreate().m_Owner << ". Cost is " << PrintableAmount(valDeposit, false) << ". Fee is " << PrintableAmount(builder.m_Fee, false); } @@ -126,7 +126,7 @@ namespace beam::wallet if (GetState() == State::KernelConfirmation) { - LOG_INFO() << GetTxID() << " Asset with the owner ID " << builder.m_pKrn->CastTo_AssetCreate().m_Owner << " successfully registered"; + BEAM_LOG_INFO() << GetTxID() << " Asset with the owner ID " << builder.m_pKrn->CastTo_AssetCreate().m_Owner << " successfully registered"; SetState(State::AssetConfirmation); ConfirmAsset(); return; diff --git a/wallet/transactions/assets/aunregister_transaction.cpp b/wallet/transactions/assets/aunregister_transaction.cpp index c7cd406b5..5842a11e6 100644 --- a/wallet/transactions/assets/aunregister_transaction.cpp +++ b/wallet/transactions/assets/aunregister_transaction.cpp @@ -80,7 +80,7 @@ namespace beam::wallet if (GetState() == State::Initial) { - LOG_INFO() + BEAM_LOG_INFO() << GetTxID() << " Unregistering asset with the owner id " << builder.m_pidAsset << ". Refund amount is " << PrintableAmount(wa.m_Deposit, false); @@ -112,7 +112,7 @@ namespace beam::wallet if (wa.m_Value != Zero) { - LOG_INFO () << "AID " << wa.m_ID << " value " << AmountBig::get_Lo(wa.m_Value); + BEAM_LOG_INFO () << "AID " << wa.m_ID << " value " << AmountBig::get_Lo(wa.m_Value); OnFailed(TxFailureReason::AssetInUse); return; } diff --git a/wallet/transactions/dex/dex_tx.cpp b/wallet/transactions/dex/dex_tx.cpp index 7a0075d08..79d743897 100644 --- a/wallet/transactions/dex/dex_tx.cpp +++ b/wallet/transactions/dex/dex_tx.cpp @@ -225,7 +225,7 @@ namespace beam::wallet << PrintableAmount(_builder->m_ReceiveAmount, false, _builder->m_ReceiveAssetID); ss << " (fee: " << PrintableAmount(_builder->m_Fee) << ")"; - LOG_INFO() << ss.str(); + BEAM_LOG_INFO() << ss.str(); BaseTxBuilder::Balance bb(*_builder); bb.m_Map[_builder->m_AssetID].m_Value -= _builder->m_Amount; @@ -238,7 +238,7 @@ namespace beam::wallet Height maxResponseHeight = 0; if (GetParameter(TxParameterID::PeerResponseHeight, maxResponseHeight)) { - LOG_INFO() << GetTxID() << " Max height for response: " << maxResponseHeight; + BEAM_LOG_INFO() << GetTxID() << " Max height for response: " << maxResponseHeight; } } diff --git a/wallet/transactions/dex/dex_tx_builder.cpp b/wallet/transactions/dex/dex_tx_builder.cpp index 41d611227..aa0f948ea 100644 --- a/wallet/transactions/dex/dex_tx_builder.cpp +++ b/wallet/transactions/dex/dex_tx_builder.cpp @@ -56,7 +56,7 @@ namespace beam::wallet } else { - LOG_INFO() << m_Tx.GetTxID() << " Transaction accepted. Kernel: " << GetKernelIDString(); + BEAM_LOG_INFO() << m_Tx.GetTxID() << " Transaction accepted. Kernel: " << GetKernelIDString(); } m_Tx.SendTxParametersStrict(std::move(msg)); diff --git a/wallet/transactions/lelantus/pull_transaction.cpp b/wallet/transactions/lelantus/pull_transaction.cpp index 616177593..170f27e98 100644 --- a/wallet/transactions/lelantus/pull_transaction.cpp +++ b/wallet/transactions/lelantus/pull_transaction.cpp @@ -72,7 +72,7 @@ namespace beam::wallet::lelantus ShieldedCoin& sc = *shieldedCoin; Asset::ID aid = sc.m_CoinID.m_AssetID; - LOG_INFO() << m_Context << " Extracting from shielded pool:" + BEAM_LOG_INFO() << m_Context << " Extracting from shielded pool:" << " ID - " << shieldedId << ", amount - " << PrintableAmount(sc.m_CoinID.m_Value, false, aid) << ", receiving amount - " << PrintableAmount(sc.m_CoinID.m_Value, false, aid) << " (fee: " << PrintableAmount(builder.m_Fee) << ")"; @@ -147,7 +147,7 @@ namespace beam::wallet::lelantus void PullTransaction::RollbackTx() { - LOG_INFO() << m_Context << " Transaction failed. Rollback..."; + BEAM_LOG_INFO() << m_Context << " Transaction failed. Rollback..."; GetWalletDB()->restoreShieldedCoinsSpentByTx(GetTxID()); GetWalletDB()->deleteCoinsCreatedByTx(GetTxID()); } diff --git a/wallet/transactions/lelantus/push_transaction.cpp b/wallet/transactions/lelantus/push_transaction.cpp index dfac67672..cee305c8f 100644 --- a/wallet/transactions/lelantus/push_transaction.cpp +++ b/wallet/transactions/lelantus/push_transaction.cpp @@ -98,7 +98,7 @@ namespace beam::wallet::lelantus bb.CompleteBalance(); - LOG_INFO() + BEAM_LOG_INFO() << m_Context << " Sending to shielded pool " << PrintableAmount(builder.m_Value, false, builder.m_AssetID) << " (fee: " << PrintableAmount(builder.m_Fee) << ")"; @@ -225,7 +225,7 @@ namespace beam::wallet::lelantus void PushTransaction::RollbackTx() { - LOG_INFO() << m_Context << " Transaction failed. Rollback..."; + BEAM_LOG_INFO() << m_Context << " Transaction failed. Rollback..."; m_Context.GetWalletDB()->restoreCoinsSpentByTx(GetTxID()); m_Context.GetWalletDB()->deleteCoinsCreatedByTx(GetTxID()); GetWalletDB()->deleteShieldedCoinsCreatedByTx(GetTxID()); diff --git a/wallet/transactions/lelantus/unlink_transaction.cpp b/wallet/transactions/lelantus/unlink_transaction.cpp index 52d4294a7..aa6a89a0e 100644 --- a/wallet/transactions/lelantus/unlink_transaction.cpp +++ b/wallet/transactions/lelantus/unlink_transaction.cpp @@ -142,7 +142,7 @@ namespace beam::wallet::lelantus void UnlinkFundsTransaction::Cancel() { - LOG_INFO() << "Canceling unlink transaction"; + BEAM_LOG_INFO() << "Canceling unlink transaction"; const auto state = GetState(); switch (state) { @@ -190,7 +190,7 @@ namespace beam::wallet::lelantus auto amount = GetMandatoryParameter(TxParameterID::Amount); if (amount <= fee) { - LOG_ERROR() << m_Context << "Cannot extract shielded coin, fee is to big."; + BEAM_LOG_ERROR() << m_Context << "Cannot extract shielded coin, fee is to big."; throw TransactionFailedException(false, TxFailureReason::ExtractFeeTooBig); } CreateInsertTransaction(); @@ -253,7 +253,7 @@ namespace beam::wallet::lelantus m_Root.UpdateAsync(); break; default: - LOG_ERROR() << "Unexpected state: " << int(state); + BEAM_LOG_ERROR() << "Unexpected state: " << int(state); throw TransactionFailedException(false, TxFailureReason::Unknown); } diff --git a/wallet/transactions/swaps/bridges/bitcoin/bitcoin_core_016.cpp b/wallet/transactions/swaps/bridges/bitcoin/bitcoin_core_016.cpp index 3c4bddb60..819f3951d 100644 --- a/wallet/transactions/swaps/bridges/bitcoin/bitcoin_core_016.cpp +++ b/wallet/transactions/swaps/bridges/bitcoin/bitcoin_core_016.cpp @@ -466,7 +466,7 @@ namespace beam::bitcoin if ((result.end() != itErr) && !itErr->empty()) { - LOG_INFO() << "Bitcoin Core returns message: " << error.m_message; + BEAM_LOG_INFO() << "Bitcoin Core returns message: " << error.m_message; } else { diff --git a/wallet/transactions/swaps/bridges/bitcoin/bitcoin_side.cpp b/wallet/transactions/swaps/bridges/bitcoin/bitcoin_side.cpp index 54db30516..5c4599f72 100644 --- a/wallet/transactions/swaps/bridges/bitcoin/bitcoin_side.cpp +++ b/wallet/transactions/swaps/bridges/bitcoin/bitcoin_side.cpp @@ -408,7 +408,7 @@ namespace beam::wallet { if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return false; } // is need to setup type 'legacy'? @@ -484,7 +484,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return false; } @@ -536,7 +536,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return SwapTxState::CreatingTx; } @@ -554,7 +554,7 @@ namespace beam::wallet { if (!m_SwapLockRawTx.is_initialized()) { - LOG_ERROR() << m_tx.GetTxID() << "[" << (int)SubTxIndex::LOCK_TX << "]" << " Incorrect state, rebuilding."; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << (int)SubTxIndex::LOCK_TX << "]" << " Incorrect state, rebuilding."; m_tx.SetState(SwapTxState::Initial, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); return SwapTxState::Initial; @@ -562,7 +562,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return SwapTxState::CreatingTx; } @@ -612,7 +612,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return swapTxState; } @@ -625,7 +625,7 @@ namespace beam::wallet { if (!m_SwapWithdrawRawTx.is_initialized()) { - LOG_ERROR() << m_tx.GetTxID() << "[" << subTxID << "]" << " Incorrect state, rebuilding."; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << subTxID << "]" << " Incorrect state, rebuilding."; m_tx.SetState(SwapTxState::Initial, subTxID); return SwapTxState::Initial; } @@ -648,7 +648,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return; } @@ -668,7 +668,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return; } @@ -695,7 +695,7 @@ namespace beam::wallet if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return; } @@ -733,7 +733,7 @@ namespace beam::wallet { if (!m_bitcoinBridge) { - LOG_ERROR() << kBridgeNotConnectedError; + BEAM_LOG_ERROR() << kBridgeNotConnectedError; return m_blockCount; } @@ -761,7 +761,7 @@ namespace beam::wallet return; } - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(subTxID) << "]" << " Bridge internal error: type = " << error.m_type << "; message = " << error.m_message; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(subTxID) << "]" << " Bridge internal error: type = " << error.m_type << "; message = " << error.m_message; switch (error.m_type) { case bitcoin::IBridge::EmptyResult: @@ -800,7 +800,7 @@ namespace beam::wallet } catch (const std::exception& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::Unknown, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); @@ -893,12 +893,12 @@ namespace beam::wallet } catch (const TransactionFailedException& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, ex.GetReason(), false, subTxID); } catch (const std::exception& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::Unknown, false, subTxID); } @@ -1051,7 +1051,7 @@ namespace beam::wallet Amount swapAmount = m_tx.GetMandatoryParameter(TxParameterID::AtomicSwapAmount); if (swapAmount > amount) { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Unexpected amount, expected: " << swapAmount << ", got: " << amount; m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::SwapInvalidAmount, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); @@ -1103,13 +1103,13 @@ namespace beam::wallet } catch (const TransactionFailedException& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, ex.GetReason(), false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); } catch (const std::exception& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::Unknown, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); @@ -1139,7 +1139,7 @@ namespace beam::wallet } catch (const std::exception& ex) { - LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << " exception msg: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::Unknown, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); diff --git a/wallet/transactions/swaps/bridges/bitcoin/electrum.cpp b/wallet/transactions/swaps/bridges/bitcoin/electrum.cpp index d11617aef..2fc24d991 100644 --- a/wallet/transactions/swaps/bridges/bitcoin/electrum.cpp +++ b/wallet/transactions/swaps/bridges/bitcoin/electrum.cpp @@ -466,7 +466,7 @@ namespace beam::bitcoin Result res = connection.m_stream->write(request.data(), request.size()); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } return true; } @@ -571,7 +571,7 @@ namespace beam::bitcoin Result res = connection.m_stream->write(request.data(), request.size()); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } return true; } @@ -602,7 +602,7 @@ namespace beam::bitcoin request += "\n"; auto settings = m_settingsProvider.GetSettings(); - //LOG_INFO() << request; + //BEAM_LOG_INFO() << request; io::Address address; std::string host; { @@ -622,7 +622,7 @@ namespace beam::bitcoin { tryToChangeAddress(); - LOG_ERROR() << "unable to resolve electrum address: " << electrumSettings.m_address; + BEAM_LOG_ERROR() << "unable to resolve electrum address: " << electrumSettings.m_address; // TODO maybe to need async?? Error error{ IOError, "unable to resolve electrum address: " + electrumSettings.m_address }; @@ -667,7 +667,7 @@ namespace beam::bitcoin { std::string strResponse = std::string(static_cast(data), size); - //LOG_INFO() << "strResponse: " << strResponse; + //BEAM_LOG_INFO() << "strResponse: " << strResponse; try { json reply = json::parse(strResponse); @@ -700,7 +700,7 @@ namespace beam::bitcoin Result res = connection.m_stream->write(connection.m_request.data(), connection.m_request.size()); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } return true; } @@ -784,7 +784,7 @@ namespace beam::bitcoin } if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } } else @@ -805,7 +805,7 @@ namespace beam::bitcoin if (result) return; - LOG_ERROR() << "error in Electrum::sendRequest: code = " << io::error_descr(result.error()); + BEAM_LOG_ERROR() << "error in Electrum::sendRequest: code = " << io::error_descr(result.error()); Error error{ IOError, std::string("error in Electrum::sendRequest: code = ") + io::error_descr(result.error()) }; json tmp; diff --git a/wallet/transactions/swaps/bridges/ethereum/ethereum_bridge.cpp b/wallet/transactions/swaps/bridges/ethereum/ethereum_bridge.cpp index b0bb1fc97..834aadf6a 100644 --- a/wallet/transactions/swaps/bridges/ethereum/ethereum_bridge.cpp +++ b/wallet/transactions/swaps/bridges/ethereum/ethereum_bridge.cpp @@ -698,7 +698,7 @@ void EthereumBridge::sendRequest( if (!address.resolve(url.c_str())) { - LOG_ERROR() << "unable to resolve electrum address: " << url; + BEAM_LOG_ERROR() << "unable to resolve electrum address: " << url; // TODO maybe to need async?? Error error{ IOError, "unable to resolve ethereum provider address: " + url }; diff --git a/wallet/transactions/swaps/bridges/ethereum/ethereum_side.cpp b/wallet/transactions/swaps/bridges/ethereum/ethereum_side.cpp index 194e9071e..0a395446e 100644 --- a/wallet/transactions/swaps/bridges/ethereum/ethereum_side.cpp +++ b/wallet/transactions/swaps/bridges/ethereum/ethereum_side.cpp @@ -158,7 +158,7 @@ bool EthereumSide::ConfirmLockTx() if (amount != swapAmount) { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Unexpected amount, expected: " << swapAmount.str() << ", got: " << amount.str(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::SwapInvalidAmount, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); @@ -171,7 +171,7 @@ bool EthereumSide::ConfirmLockTx() if (txInputStr != lockTxDataStr) { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Transaction data does not match."; m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::SwapInvalidContract, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); @@ -180,7 +180,7 @@ bool EthereumSide::ConfirmLockTx() } catch (const std::exception& ex) { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Failed to parse txInfo: " << ex.what(); + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Failed to parse txInfo: " << ex.what(); m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::SwapFormatResponseError, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); return; @@ -202,7 +202,7 @@ bool EthereumSide::ConfirmLockTx() case ethereum::IBridge::ErrorType::InvalidResultFormat: case ethereum::IBridge::ErrorType::EthError: { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Transaction is not valid."; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Transaction is not valid."; m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::InvalidTransaction, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); return; @@ -325,7 +325,7 @@ bool EthereumSide::SendLockTx() case ethereum::IBridge::ErrorType::InvalidResultFormat: case ethereum::IBridge::ErrorType::EthError: { - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Transaction is not valid."; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "]" << " Transaction is not valid."; m_tx.SetParameter(TxParameterID::InternalFailureReason, TxFailureReason::InvalidTransaction, false, SubTxIndex::LOCK_TX); m_tx.UpdateAsync(); return; @@ -612,7 +612,7 @@ void EthereumSide::SetTxError(const ethereum::IBridge::Error& error, SubTxID sub return; } - LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(subTxID) << "]" << " Bridge internal error: type = " << error.m_type << "; message = " << error.m_message; + BEAM_LOG_ERROR() << m_tx.GetTxID() << "[" << static_cast(subTxID) << "]" << " Bridge internal error: type = " << error.m_type << "; message = " << error.m_message; switch (error.m_type) { case ethereum::IBridge::EmptyResult: diff --git a/wallet/transactions/swaps/swap_transaction.cpp b/wallet/transactions/swaps/swap_transaction.cpp index 895528d10..7f6edc45f 100644 --- a/wallet/transactions/swaps/swap_transaction.cpp +++ b/wallet/transactions/swaps/swap_transaction.cpp @@ -316,7 +316,7 @@ namespace beam::wallet auto receiverAddr = m_walletDB->getAddress(*peerID); if (receiverAddr && receiverAddr->isOwn()) { - LOG_ERROR() << "Failed to initiate the atomic swap. Not able to use own address as receiver's."; + BEAM_LOG_ERROR() << "Failed to initiate the atomic swap. Not able to use own address as receiver's."; throw FailToStartSwapException(); } } @@ -362,7 +362,7 @@ namespace beam::wallet return; } - LOG_INFO() << GetTxID() << " You cannot cancel transaction in state: " << static_cast(GetState(kDefaultSubTxID)); + BEAM_LOG_INFO() << GetTxID() << " You cannot cancel transaction in state: " << static_cast(GetState(kDefaultSubTxID)); } bool AtomicSwapTransaction::Rollback(Height height) @@ -517,7 +517,7 @@ namespace beam::wallet Height lifeTime = GetMandatoryParameter(TxParameterID::Lifetime); if (lifeTime > kBeamLockTxLifetimeMax) { - LOG_ERROR() << GetTxID() << "[" << static_cast(SubTxIndex::BEAM_LOCK_TX) << "] " << "Transaction's lifetime is unacceptable."; + BEAM_LOG_ERROR() << GetTxID() << "[" << static_cast(SubTxIndex::BEAM_LOCK_TX) << "] " << "Transaction's lifetime is unacceptable."; OnSubTxFailed(TxFailureReason::InvalidTransaction, SubTxIndex::BEAM_LOCK_TX, true); break; } @@ -536,7 +536,7 @@ namespace beam::wallet SetParameter(TxParameterID::MinHeight, currentHeight, false, SubTxIndex::BEAM_LOCK_TX); SendInvitation(); - LOG_INFO() << GetTxID() << " Invitation sent."; + BEAM_LOG_INFO() << GetTxID() << " Invitation sent."; } else { @@ -559,7 +559,7 @@ namespace beam::wallet if (!secondSide->ValidateLockTime()) { - LOG_ERROR() << GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "] " << "Lock height is unacceptable."; + BEAM_LOG_ERROR() << GetTxID() << "[" << static_cast(SubTxIndex::LOCK_TX) << "] " << "Lock height is unacceptable."; OnSubTxFailed(TxFailureReason::InvalidTransaction, SubTxIndex::LOCK_TX, true); break; } @@ -571,7 +571,7 @@ namespace beam::wallet auto minHeight = GetMandatoryParameter(TxParameterID::MinHeight, SubTxIndex::BEAM_LOCK_TX); if (minHeight < mainMinHeight || minHeight >= mainPeerResponseHeight) { - LOG_WARNING() << "mainMinHeight=" << mainMinHeight << ", locktxMinHeight=" << minHeight << ", peerHeight=" << mainPeerResponseHeight; + BEAM_LOG_WARNING() << "mainMinHeight=" << mainMinHeight << ", locktxMinHeight=" << minHeight << ", peerHeight=" << mainPeerResponseHeight; OnSubTxFailed(TxFailureReason::MinHeightIsUnacceptable, SubTxIndex::BEAM_LOCK_TX, true); break; } @@ -593,7 +593,7 @@ namespace beam::wallet UpdateOnNextTip(); break; } - LOG_INFO() << GetTxID() << " Beam LockTX constructed."; + BEAM_LOG_INFO() << GetTxID() << " Beam LockTX constructed."; SetNextState(State::BuildingBeamRefundTX); break; } @@ -604,7 +604,7 @@ namespace beam::wallet break; m_WithdrawTx.reset(); - LOG_INFO() << GetTxID() << " Beam RefundTX constructed."; + BEAM_LOG_INFO() << GetTxID() << " Beam RefundTX constructed."; SetNextState(State::BuildingBeamRedeemTX); break; } @@ -615,7 +615,7 @@ namespace beam::wallet break; m_WithdrawTx.reset(); - LOG_INFO() << GetTxID() << " Beam RedeemTX constructed."; + BEAM_LOG_INFO() << GetTxID() << " Beam RedeemTX constructed."; SetNextState(State::HandlingContractTX); break; } @@ -647,7 +647,7 @@ namespace beam::wallet } } - LOG_INFO() << GetTxID() << " LockTX completed."; + BEAM_LOG_INFO() << GetTxID() << " LockTX completed."; SetNextState(State::SendingBeamLockTX); break; } @@ -672,7 +672,7 @@ namespace beam::wallet break; } - LOG_INFO() << GetTxID() << " RefundTX completed!"; + BEAM_LOG_INFO() << GetTxID() << " RefundTX completed!"; SetNextState(State::Refunded); break; } @@ -688,7 +688,7 @@ namespace beam::wallet break; } - LOG_INFO() << GetTxID() << " RedeemTX completed!"; + BEAM_LOG_INFO() << GetTxID() << " RedeemTX completed!"; SetNextState(State::CompleteSwap); break; } @@ -704,7 +704,7 @@ namespace beam::wallet if (!isBeamOwner && m_secondSide->IsLockTimeExpired()) { - LOG_INFO() << GetTxID() << " Locktime is expired."; + BEAM_LOG_INFO() << GetTxID() << " Locktime is expired."; SetNextState(State::SendingRefundTX); break; } @@ -712,7 +712,7 @@ namespace beam::wallet if (!CompleteSubTx(SubTxIndex::BEAM_LOCK_TX)) break; - LOG_INFO() << GetTxID() << " Beam LockTX completed."; + BEAM_LOG_INFO() << GetTxID() << " Beam LockTX completed."; SetNextState(State::SendingBeamRedeemTX); break; } @@ -736,7 +736,7 @@ namespace beam::wallet if (kernelUnconfirmedHeight > refundMinHeight) { - LOG_INFO() << GetTxID() << " Beam locktime expired."; + BEAM_LOG_INFO() << GetTxID() << " Beam locktime expired."; SetNextState(State::SendingBeamRefundTX); break; } @@ -756,7 +756,7 @@ namespace beam::wallet { if (!IsBeamRedeemTxRegistered() && !IsSafeToSendBeamRedeemTx()) { - LOG_INFO() << GetTxID() << " Not enough time to finish Beam redeem transaction."; + BEAM_LOG_INFO() << GetTxID() << " Not enough time to finish Beam redeem transaction."; SetNextState(State::SendingRefundTX); break; } @@ -764,7 +764,7 @@ namespace beam::wallet if (!CompleteBeamWithdrawTx(SubTxIndex::BEAM_REDEEM_TX)) break; - LOG_INFO() << GetTxID() << " Beam RedeemTX completed!"; + BEAM_LOG_INFO() << GetTxID() << " Beam RedeemTX completed!"; SetNextState(State::CompleteSwap); } break; @@ -781,7 +781,7 @@ namespace beam::wallet if (!CompleteBeamWithdrawTx(SubTxIndex::BEAM_REFUND_TX)) break; - LOG_INFO() << GetTxID() << " Beam Refund TX completed!"; + BEAM_LOG_INFO() << GetTxID() << " Beam Refund TX completed!"; SendQuickRefundPrivateKey(); SetNextState(State::Refunded); @@ -789,14 +789,14 @@ namespace beam::wallet } case State::CompleteSwap: { - LOG_INFO() << GetTxID() << " Swap completed."; + BEAM_LOG_INFO() << GetTxID() << " Swap completed."; UpdateTxDescription(TxStatus::Completed); GetGateway().on_tx_completed(GetTxID()); break; } case State::Canceled: { - LOG_INFO() << GetTxID() << " Transaction cancelled."; + BEAM_LOG_INFO() << GetTxID() << " Transaction cancelled."; NotifyFailure(TxFailureReason::Canceled); UpdateTxDescription(TxStatus::Canceled); @@ -817,16 +817,16 @@ namespace beam::wallet { if (reason == TxFailureReason::Canceled) { - LOG_ERROR() << GetTxID() << " Swap cancelled. The other side has cancelled the transaction."; + BEAM_LOG_ERROR() << GetTxID() << " Swap cancelled. The other side has cancelled the transaction."; } else { - LOG_ERROR() << GetTxID() << " The other side has failed the transaction. Reason: " << GetFailureMessage(reason); + BEAM_LOG_ERROR() << GetTxID() << " The other side has failed the transaction. Reason: " << GetFailureMessage(reason); } } else { - LOG_ERROR() << GetTxID() << " Transaction failed."; + BEAM_LOG_ERROR() << GetTxID() << " Transaction failed."; } UpdateTxDescription(TxStatus::Failed); GetGateway().on_tx_failed(GetTxID()); @@ -835,7 +835,7 @@ namespace beam::wallet case State::Refunded: { - LOG_INFO() << GetTxID() << " Swap has not succeeded."; + BEAM_LOG_INFO() << GetTxID() << " Swap has not succeeded."; UpdateTxDescription(TxStatus::Failed); GetGateway().on_tx_failed(GetTxID()); break; @@ -886,7 +886,7 @@ namespace beam::wallet void AtomicSwapTransaction::OnFailed(TxFailureReason reason, bool notify) { - LOG_ERROR() << GetTxID() << " Failed. " << GetFailureMessage(reason); + BEAM_LOG_ERROR() << GetTxID() << " Failed. " << GetFailureMessage(reason); if (reason == TxFailureReason::NoInputs) { @@ -952,7 +952,7 @@ namespace beam::wallet { if (isBeamSide) { - LOG_ERROR() << GetTxID() << " Unexpected error."; + BEAM_LOG_ERROR() << GetTxID() << " Unexpected error."; return; } else @@ -1001,7 +1001,7 @@ namespace beam::wallet Block::SystemState::Full state; if (GetTip(state) && state.m_Height > lockTxMaxHeight) { - LOG_INFO() << GetTxID() << " Transaction expired. Current height: " << state.m_Height << ", max kernel height: " << lockTxMaxHeight; + BEAM_LOG_INFO() << GetTxID() << " Transaction expired. Current height: " << state.m_Height << ", max kernel height: " << lockTxMaxHeight; OnFailed(TxFailureReason::TransactionExpired, false); return true; } @@ -1013,7 +1013,7 @@ namespace beam::wallet { if (lastUnconfirmedHeight >= lockTxMaxHeight) { - LOG_INFO() << GetTxID() << " Transaction expired. Last unconfirmed height: " << lastUnconfirmedHeight << ", max kernel height: " << lockTxMaxHeight; + BEAM_LOG_INFO() << GetTxID() << " Transaction expired. Last unconfirmed height: " << lastUnconfirmedHeight << ", max kernel height: " << lockTxMaxHeight; OnFailed(TxFailureReason::TransactionExpired, false); return true; } @@ -1059,11 +1059,11 @@ namespace beam::wallet { if (reason == TxFailureReason::Canceled) { - LOG_ERROR() << GetTxID() << " Swap cancelled. The other side has cancelled the transaction."; + BEAM_LOG_ERROR() << GetTxID() << " Swap cancelled. The other side has cancelled the transaction."; } else { - LOG_ERROR() << GetTxID() << " The other side has failed the transaction. Reason: " << GetFailureMessage(reason); + BEAM_LOG_ERROR() << GetTxID() << " The other side has failed the transaction. Reason: " << GetFailureMessage(reason); } SetState(State::SendingRefundTX); @@ -1455,7 +1455,7 @@ namespace beam::wallet return; } - LOG_ERROR() << GetTxID() << "[" << subTxID << "]" << " Failed. " << GetFailureMessage(reason); + BEAM_LOG_ERROR() << GetTxID() << "[" << subTxID << "]" << " Failed. " << GetFailureMessage(reason); SetParameter(TxParameterID::InternalFailureReason, reason, false, subTxID); OnFailed(TxFailureReason::SubTxFailed, notify); diff --git a/wallet/unittests/bitcoin_rpc_environment.cpp b/wallet/unittests/bitcoin_rpc_environment.cpp index b3ae3cbc2..a028baeb8 100644 --- a/wallet/unittests/bitcoin_rpc_environment.cpp +++ b/wallet/unittests/bitcoin_rpc_environment.cpp @@ -118,7 +118,7 @@ class BitcoinHttpServer } else { - LOG_ERROR() << "Server error " << io::error_str(errorCode); + BEAM_LOG_ERROR() << "Server error " << io::error_str(errorCode); stopServer(); } } @@ -147,7 +147,7 @@ class BitcoinHttpServer } else { - LOG_ERROR() << "Request is wrong"; + BEAM_LOG_ERROR() << "Request is wrong"; stopServer(); } } @@ -171,7 +171,7 @@ class BitcoinHttpServer } else { - LOG_ERROR() << "Cannot create response"; + BEAM_LOG_ERROR() << "Cannot create response"; stopServer(); } diff --git a/wallet/unittests/bitcoin_rpc_test.cpp b/wallet/unittests/bitcoin_rpc_test.cpp index 9b30c5c01..05c2fa9fc 100644 --- a/wallet/unittests/bitcoin_rpc_test.cpp +++ b/wallet/unittests/bitcoin_rpc_test.cpp @@ -299,9 +299,9 @@ void testConnectionRefused() int main() { - int logLevel = LOG_LEVEL_WARNING; + int logLevel = BEAM_LOG_LEVEL_WARNING; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = beam::Logger::create(logLevel, logLevel); diff --git a/wallet/unittests/electrum_test.cpp b/wallet/unittests/electrum_test.cpp index 95f80768f..877db1139 100644 --- a/wallet/unittests/electrum_test.cpp +++ b/wallet/unittests/electrum_test.cpp @@ -150,7 +150,7 @@ void testAddress() { electrum.getRawChangeAddress([mainReactor, addresses](const bitcoin::IBridge::Error&, const std::string& addr) { - LOG_INFO() << "generated address = " << addr; + BEAM_LOG_INFO() << "generated address = " << addr; WALLET_CHECK(addresses.find(addr) != addresses.end()); }); @@ -191,7 +191,7 @@ void testConnection() io::Result res = sslStream->write(request.data(), request.size()); if (!res) { - LOG_ERROR() << error_str(res.error()); + BEAM_LOG_ERROR() << error_str(res.error()); } }, 2000, { true, false }); @@ -439,7 +439,7 @@ void testReconnectToInvalidAddresses() int main() { - int logLevel = LOG_LEVEL_WARNING; + int logLevel = BEAM_LOG_LEVEL_WARNING; auto logger = beam::Logger::create(logLevel, logLevel); testAddress(); diff --git a/wallet/unittests/ethereum_test.cpp b/wallet/unittests/ethereum_test.cpp index 7223b6aad..03234e545 100644 --- a/wallet/unittests/ethereum_test.cpp +++ b/wallet/unittests/ethereum_test.cpp @@ -739,7 +739,7 @@ void testERC20MultipleApprove() int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = beam::Logger::create(logLevel, logLevel); testAddress(); diff --git a/wallet/unittests/laser_test_auto_close.cpp b/wallet/unittests/laser_test_auto_close.cpp index 1ca25f0d1..c567bc7f6 100644 --- a/wallet/unittests/laser_test_auto_close.cpp +++ b/wallet/unittests/laser_test_auto_close.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -61,30 +61,30 @@ int main() observer_1.onOpened = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: first opened"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: first opened"; }; observer_2.onOpened = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: second opened"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: second opened"; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: open failed"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: first closed"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: second closed"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser AUTO CLOSE: close failed"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: close failed"; WALLET_CHECK(false); }; laserFirst->AddObserver(&observer_1); @@ -94,7 +94,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser AUTO CLOSE: time expired"; + BEAM_LOG_ERROR() << "Test laser AUTO CLOSE: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -108,7 +108,7 @@ int main() if (laser1Closed && laser2Closed) { - LOG_INFO() << "Test laser AUTO CLOSE: finished"; + BEAM_LOG_INFO() << "Test laser AUTO CLOSE: finished"; io::Reactor::get_Current().stop(); } }; diff --git a/wallet/unittests/laser_test_close.cpp b/wallet/unittests/laser_test_close.cpp index 863813c39..40ea945c9 100644 --- a/wallet/unittests/laser_test_close.cpp +++ b/wallet/unittests/laser_test_close.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -63,32 +63,32 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: first opened"; + BEAM_LOG_INFO() << "Test laser CLOSE: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: second opened"; + BEAM_LOG_INFO() << "Test laser CLOSE: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: open failed"; + BEAM_LOG_INFO() << "Test laser CLOSE: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: first closed"; + BEAM_LOG_INFO() << "Test laser CLOSE: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: second closed"; + BEAM_LOG_INFO() << "Test laser CLOSE: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser CLOSE: close failed"; + BEAM_LOG_INFO() << "Test laser CLOSE: close failed"; WALLET_CHECK(false); }; laserFirst->AddObserver(&observer_1); @@ -98,7 +98,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser CLOSE: time expired"; + BEAM_LOG_ERROR() << "Test laser CLOSE: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -119,7 +119,7 @@ int main() if (laser1Closed && laser2Closed) { - LOG_INFO() << "Test laser CLOSE: finished"; + BEAM_LOG_INFO() << "Test laser CLOSE: finished"; io::Reactor::get_Current().stop(); } diff --git a/wallet/unittests/laser_test_delete.cpp b/wallet/unittests/laser_test_delete.cpp index 96070426d..4f7806afc 100644 --- a/wallet/unittests/laser_test_delete.cpp +++ b/wallet/unittests/laser_test_delete.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -64,32 +64,32 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: first opened"; + BEAM_LOG_INFO() << "Test laser DELETE: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: second opened"; + BEAM_LOG_INFO() << "Test laser DELETE: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: open failed"; + BEAM_LOG_INFO() << "Test laser DELETE: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: first closed"; + BEAM_LOG_INFO() << "Test laser DELETE: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: second closed"; + BEAM_LOG_INFO() << "Test laser DELETE: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DELETE: close failed"; + BEAM_LOG_INFO() << "Test laser DELETE: close failed"; WALLET_CHECK(false); }; laserFirst->AddObserver(&observer_1); @@ -99,7 +99,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser DELETE: time expired"; + BEAM_LOG_ERROR() << "Test laser DELETE: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -114,7 +114,7 @@ int main() if (channel_1 && channel_2 && !closingStarted) { closingStarted = true; - LOG_INFO() << "Test laser DELETE: closing started"; + BEAM_LOG_INFO() << "Test laser DELETE: closing started"; auto channel1Str = to_hex(channel_1->m_pData, channel_1->nBytes); WALLET_CHECK(laserFirst->GracefulClose(channel1Str)); } @@ -122,7 +122,7 @@ int main() if (laser1Closed && laser2Closed && !closedAt) { closedAt = height; - LOG_INFO() << "Test laser DELETE: before post lock reserve"; + BEAM_LOG_INFO() << "Test laser DELETE: before post lock reserve"; auto channel1Str = to_hex(channel_1->m_pData, channel_1->nBytes); WALLET_CHECK(!laserFirst->Delete(channel1Str)); auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); @@ -131,7 +131,7 @@ int main() if (closedAt && height == closedAt + kPostLockReserve + 1) { - LOG_INFO() << "Test laser DELETE: after post lock reserve"; + BEAM_LOG_INFO() << "Test laser DELETE: after post lock reserve"; auto channel1Str = to_hex(channel_1->m_pData, channel_1->nBytes); WALLET_CHECK(laserFirst->Delete(channel1Str)); auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); diff --git a/wallet/unittests/laser_test_drop.cpp b/wallet/unittests/laser_test_drop.cpp index bb5d4f6bd..41366b1b8 100644 --- a/wallet/unittests/laser_test_drop.cpp +++ b/wallet/unittests/laser_test_drop.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -63,32 +63,32 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: first opened"; + BEAM_LOG_INFO() << "Test laser DROP: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: second opened"; + BEAM_LOG_INFO() << "Test laser DROP: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: open failed"; + BEAM_LOG_INFO() << "Test laser DROP: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: first closed"; + BEAM_LOG_INFO() << "Test laser DROP: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: second closed"; + BEAM_LOG_INFO() << "Test laser DROP: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser DROP: close failed"; + BEAM_LOG_INFO() << "Test laser DROP: close failed"; WALLET_CHECK(false); }; laserFirst->AddObserver(&observer_1); @@ -98,7 +98,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser DROP: time expired"; + BEAM_LOG_ERROR() << "Test laser DROP: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -119,7 +119,7 @@ int main() if (laser1Closed && laser2Closed) { - LOG_INFO() << "Test laser CLOSE: finished"; + BEAM_LOG_INFO() << "Test laser CLOSE: finished"; io::Reactor::get_Current().stop(); } diff --git a/wallet/unittests/laser_test_listen_first.cpp b/wallet/unittests/laser_test_listen_first.cpp index b825a3a35..a563855e6 100644 --- a/wallet/unittests/laser_test_listen_first.cpp +++ b/wallet/unittests/laser_test_listen_first.cpp @@ -38,9 +38,9 @@ const Amount kTransferFirst = 10000; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -70,47 +70,47 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: first opened"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: second opened"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: open failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: first closed"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: second closed"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: close failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: close failed"; WALLET_CHECK(false); }; observer_1.onUpdateFinished = [&firstUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: first updated"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: first updated"; firstUpdated = true; }; observer_2.onUpdateFinished = [&secondUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: second updated"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: second updated"; secondUpdated = true; }; observer_1.onTransferFailed = observer_2.onTransferFailed = [&firstUpdated, &secondUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 1: transfer failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: transfer failed"; WALLET_CHECK(false); firstUpdated = secondUpdated = true; }; @@ -122,7 +122,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser LISTEN 1: time expired"; + BEAM_LOG_ERROR() << "Test laser LISTEN 1: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -142,7 +142,7 @@ int main() if (openedAt && openedAt + 5 == height && !startListenAt) { startListenAt = height; - LOG_INFO() << "Test laser LISTEN 1: first serve"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: first serve"; laserFirst.reset(new laser::Mediator(wdbFirst, params)); laserFirst->AddObserver(&observer_1); laserFirst->SetNetwork(CreateNetwork(*laserFirst), false); @@ -154,7 +154,7 @@ int main() if (startListenAt && height == startListenAt + 10) { auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); - LOG_INFO() << "Test laser LISTEN 1: first send to second"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: first send to second"; WALLET_CHECK(laserFirst->Transfer(kTransferFirst, channel2Str)); } @@ -171,7 +171,7 @@ int main() if (laser1Closed && laser2Closed) { - LOG_INFO() << "Test laser LISTEN 1: finished"; + BEAM_LOG_INFO() << "Test laser LISTEN 1: finished"; io::Reactor::get_Current().stop(); } diff --git a/wallet/unittests/laser_test_listen_second.cpp b/wallet/unittests/laser_test_listen_second.cpp index 805668947..b6bba4cbb 100644 --- a/wallet/unittests/laser_test_listen_second.cpp +++ b/wallet/unittests/laser_test_listen_second.cpp @@ -38,9 +38,9 @@ const Amount kTransferFirst = 10000; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -70,47 +70,47 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: first opened"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: second opened"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: open failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: first closed"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: second closed"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: close failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: close failed"; WALLET_CHECK(false); }; observer_1.onUpdateFinished = [&firstUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: first updated"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: first updated"; firstUpdated = true; }; observer_2.onUpdateFinished = [&secondUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: second updated"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: second updated"; secondUpdated = true; }; observer_1.onTransferFailed = observer_2.onTransferFailed = [&firstUpdated, &secondUpdated](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser LISTEN 2: transfer failed"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: transfer failed"; WALLET_CHECK(false); firstUpdated = secondUpdated = true; }; @@ -122,7 +122,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser LISTEN 2: time expired"; + BEAM_LOG_ERROR() << "Test laser LISTEN 2: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -142,7 +142,7 @@ int main() if (openedAt && openedAt + 5 == height && !startListenAt) { startListenAt = height; - LOG_INFO() << "Test laser LISTEN 2: second serve"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: second serve"; laserSecond.reset(new laser::Mediator(wdbSecond, params)); laserSecond->AddObserver(&observer_2); laserSecond->SetNetwork(CreateNetwork(*laserSecond), false); @@ -153,7 +153,7 @@ int main() if (startListenAt && height == startListenAt + 10) { - LOG_INFO() << "Test laser LISTEN 2: first send to second"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: first send to second"; auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); WALLET_CHECK(laserFirst->Transfer(kTransferFirst, channel2Str)); } @@ -171,7 +171,7 @@ int main() if (laser1Closed && laser2Closed) { - LOG_INFO() << "Test laser LISTEN 2: finished"; + BEAM_LOG_INFO() << "Test laser LISTEN 2: finished"; io::Reactor::get_Current().stop(); } diff --git a/wallet/unittests/laser_test_open.cpp b/wallet/unittests/laser_test_open.cpp index a25a56478..95b6b44a8 100644 --- a/wallet/unittests/laser_test_open.cpp +++ b/wallet/unittests/laser_test_open.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -62,19 +62,19 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser OPEN: first opened"; + BEAM_LOG_INFO() << "Test laser OPEN: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser OPEN: second opened"; + BEAM_LOG_INFO() << "Test laser OPEN: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser OPEN: open failed"; + BEAM_LOG_INFO() << "Test laser OPEN: open failed"; WALLET_CHECK(false); }; laserFirst->AddObserver(&observer_1); @@ -86,7 +86,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser OPEN: time expired"; + BEAM_LOG_ERROR() << "Test laser OPEN: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -129,7 +129,7 @@ int main() val2 += AmountBig::Type(channelSecond->get_amountMy() + nFeeSecond * 3); WALLET_CHECK(totals_2.Unspent == val2); - LOG_INFO() << "Test laser OPEN: finished"; + BEAM_LOG_INFO() << "Test laser OPEN: finished"; io::Reactor::get_Current().stop(); } }; diff --git a/wallet/unittests/laser_test_open_fail.cpp b/wallet/unittests/laser_test_open_fail.cpp index 70050c34f..8a9cc0caa 100644 --- a/wallet/unittests/laser_test_open_fail.cpp +++ b/wallet/unittests/laser_test_open_fail.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -79,7 +79,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser OPEN FAIL: time expired"; + BEAM_LOG_ERROR() << "Test laser OPEN FAIL: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -93,7 +93,7 @@ int main() if (laser1Fail && laser2Fail) { - LOG_INFO() << "Test laser OPEN FAIL: finished"; + BEAM_LOG_INFO() << "Test laser OPEN FAIL: finished"; io::Reactor::get_Current().stop(); } }; diff --git a/wallet/unittests/laser_test_send.cpp b/wallet/unittests/laser_test_send.cpp index d55644cca..61cc5eae8 100644 --- a/wallet/unittests/laser_test_send.cpp +++ b/wallet/unittests/laser_test_send.cpp @@ -38,9 +38,9 @@ const Amount kTransferFirst = 2000000; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -71,41 +71,41 @@ int main() observer_1.onOpened = [&channel_1, &laserFirst, &openedAt](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: first opened"; + BEAM_LOG_INFO() << "Test laser SEND: first opened"; channel_1 = chID; const auto& channelFirst = laserFirst->getChannel(channel_1); openedAt = channelFirst->m_pOpen->m_hOpened; - LOG_INFO() << "Test laser SEND: openedAt: " << openedAt; + BEAM_LOG_INFO() << "Test laser SEND: openedAt: " << openedAt; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: second opened"; + BEAM_LOG_INFO() << "Test laser SEND: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: open failed"; + BEAM_LOG_INFO() << "Test laser SEND: open failed"; WALLET_CHECK(false); }; observer_1.onClosed = [&laser1Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: first closed"; + BEAM_LOG_INFO() << "Test laser SEND: first closed"; laser1Closed = true; }; observer_2.onClosed = [&laser2Closed](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: second closed"; + BEAM_LOG_INFO() << "Test laser SEND: second closed"; laser2Closed = true; }; observer_1.onCloseFailed = observer_2.onCloseFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: close failed"; + BEAM_LOG_INFO() << "Test laser SEND: close failed"; WALLET_CHECK(false); }; observer_1.onUpdateFinished = [&channel_1, &laserFirst, &transfersCount, &transferInProgress](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: first updated"; + BEAM_LOG_INFO() << "Test laser SEND: first updated"; const auto& channelFirst = laserFirst->getChannel(channel_1); WALLET_CHECK(channelFirst->get_amountCurrentMy() == @@ -114,7 +114,7 @@ int main() }; observer_2.onUpdateFinished = [&channel_2, &laserSecond, &transfersCount](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: second updated"; + BEAM_LOG_INFO() << "Test laser SEND: second updated"; const auto& channelSecond = laserSecond->getChannel(channel_2); WALLET_CHECK(channelSecond->get_amountCurrentMy() == @@ -122,7 +122,7 @@ int main() }; observer_1.onTransferFailed = observer_2.onTransferFailed = [&transferInProgress](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: transfer failed"; + BEAM_LOG_INFO() << "Test laser SEND: transfer failed"; WALLET_CHECK(false); transferInProgress = false; }; @@ -134,7 +134,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser SEND: time expired"; + BEAM_LOG_ERROR() << "Test laser SEND: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -156,14 +156,14 @@ int main() { transferInProgress = true; auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); - LOG_INFO() << "Test laser SEND: first send to second"; + BEAM_LOG_INFO() << "Test laser SEND: first send to second"; ++transfersCount; WALLET_CHECK(laserFirst->Transfer(kTransferFirst, channel2Str)); } if (channel_1 && channel_2 && height > openedAt + 20 && !transferInProgress && !closeProcessStarted) { - LOG_INFO() << "Test laser SEND: closing"; + BEAM_LOG_INFO() << "Test laser SEND: closing"; observer_1.onUpdateFinished = observer_2.onUpdateFinished = [](const laser::ChannelIDPtr& chID) {}; auto channel1Str = to_hex(channel_1->m_pData, channel_1->nBytes); WALLET_CHECK(laserFirst->GracefulClose(channel1Str)); @@ -186,7 +186,7 @@ int main() val2 += AmountBig::Type(kTransferFirst * transfersCount - fee); WALLET_CHECK(totals_2_a.Unspent == val2); - LOG_INFO() << "Test laser SEND: finished"; + BEAM_LOG_INFO() << "Test laser SEND: finished"; io::Reactor::get_Current().stop(); } diff --git a/wallet/unittests/laser_test_send_fail.cpp b/wallet/unittests/laser_test_send_fail.cpp index c866ee1df..94dd40b1a 100644 --- a/wallet/unittests/laser_test_send_fail.cpp +++ b/wallet/unittests/laser_test_send_fail.cpp @@ -34,9 +34,9 @@ using namespace std; int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = Logger::create(logLevel, logLevel, logLevel, "laser_test", path.string()); @@ -61,17 +61,17 @@ int main() observer_1.onOpened = [&channel_1](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: first opened"; + BEAM_LOG_INFO() << "Test laser SEND: first opened"; channel_1 = chID; }; observer_2.onOpened = [&channel_2](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: second opened"; + BEAM_LOG_INFO() << "Test laser SEND: second opened"; channel_2 = chID; }; observer_1.onOpenFailed = observer_2.onOpenFailed = [](const laser::ChannelIDPtr& chID) { - LOG_INFO() << "Test laser SEND: open failed"; + BEAM_LOG_INFO() << "Test laser SEND: open failed"; WALLET_CHECK(false); }; @@ -82,7 +82,7 @@ int main() { if (height > kMaxTestHeight) { - LOG_ERROR() << "Test laser SEND: time expired"; + BEAM_LOG_ERROR() << "Test laser SEND: time expired"; WALLET_CHECK(false); io::Reactor::get_Current().stop(); } @@ -97,10 +97,10 @@ int main() if (channel_1 && channel_2) { auto channel2Str = to_hex(channel_2->m_pData, channel_2->nBytes); - LOG_INFO() << "Test laser SEND: first send to second, amount more then locked in channel"; + BEAM_LOG_INFO() << "Test laser SEND: first send to second, amount more then locked in channel"; WALLET_CHECK(!laserFirst->Transfer(1000000000, channel2Str)); - LOG_INFO() << "Test laser SEND: finished"; + BEAM_LOG_INFO() << "Test laser SEND: finished"; io::Reactor::get_Current().stop(); } }; diff --git a/wallet/unittests/lelantus_test.cpp b/wallet/unittests/lelantus_test.cpp index 63f29b1b7..92d79fd9d 100644 --- a/wallet/unittests/lelantus_test.cpp +++ b/wallet/unittests/lelantus_test.cpp @@ -1599,7 +1599,7 @@ int main() ECC::PseudoRandomGenerator::Scope scopePrg(&prg); prg.m_hv = 71U; - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; auto logger = beam::Logger::create(logLevel, logLevel); Rules::get().FakePoW = true; Rules::get().pForks[1].m_Height = 6; diff --git a/wallet/unittests/offline.cpp b/wallet/unittests/offline.cpp index b86953f2e..6b3a250a9 100644 --- a/wallet/unittests/offline.cpp +++ b/wallet/unittests/offline.cpp @@ -29,13 +29,13 @@ struct WalletDBObserver : IWalletDbObserver { LOG_DEBUG() << _who << " " << __FUNCTION__; } void onTransactionChanged(ChangeAction, const std::vector& ) { - LOG_INFO() << _who << " QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ " << __FUNCTION__; + BEAM_LOG_INFO() << _who << " QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ " << __FUNCTION__; } void onSystemStateChanged(const Block::SystemState::ID& stateID) { - LOG_INFO() << _who << " " << __FUNCTION__; + BEAM_LOG_INFO() << _who << " " << __FUNCTION__; } void onAddressChanged(ChangeAction action, const std::vector& items) { - LOG_INFO() << _who << " " << __FUNCTION__; + BEAM_LOG_INFO() << _who << " " << __FUNCTION__; } WalletDBObserver(std::string who) : _who(std::move(who)) {} @@ -128,10 +128,10 @@ WaitHandle run_node(const NodeParams& params) { node.m_Cfg.m_Connect.push_back(params.connectTo); } else { ReadTreasury(node.m_Cfg.m_Treasury, "_sender_"); - LOG_INFO() << "Treasury blocs read: " << node.m_Cfg.m_Treasury.size(); + BEAM_LOG_INFO() << "Treasury blocs read: " << node.m_Cfg.m_Treasury.size(); } - LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; + BEAM_LOG_INFO() << "starting a node on " << node.m_Cfg.m_Listen.port() << " port..."; node.Initialize(); @@ -214,24 +214,24 @@ void test_offline(bool twoNodes) { } int test_one_node() { - LOG_INFO() << "\n====================== 1 node 2 wallets"; + BEAM_LOG_INFO() << "\n====================== 1 node 2 wallets"; int ret = 0; try { test_offline(false); } catch (const std::exception& e) { - LOG_ERROR() << "Exception: " << e.what(); + BEAM_LOG_ERROR() << "Exception: " << e.what(); ret = 1; } return ret; } int test_two_nodes() { - LOG_INFO() << "\n====================== 2 nodes 2 wallets"; + BEAM_LOG_INFO() << "\n====================== 2 nodes 2 wallets"; int ret = 0; try { test_offline(true); } catch (const std::exception& e) { - LOG_ERROR() << "Exception: " << e.what(); + BEAM_LOG_ERROR() << "Exception: " << e.what(); ret = 2; } return ret; @@ -242,9 +242,9 @@ int test_two_nodes() { int main(int argc, char* argv[]) { using namespace beam; - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); logger->set_header_formatter( diff --git a/wallet/unittests/swap_test.cpp b/wallet/unittests/swap_test.cpp index 76bec7a1f..57d3d6c04 100644 --- a/wallet/unittests/swap_test.cpp +++ b/wallet/unittests/swap_test.cpp @@ -2080,9 +2080,9 @@ void TestERC20SwapTransaction(bool isBeamOwnerStart, beam::Height fork1Height) int main() { - int logLevel = LOG_LEVEL_INFO; + int logLevel = BEAM_LOG_LEVEL_INFO; const auto path = boost::filesystem::system_complete("logs"); - auto logger = beam::Logger::create(logLevel, logLevel, LOG_LEVEL_DEBUG, "swap_test", path.string()); + auto logger = beam::Logger::create(logLevel, logLevel, BEAM_LOG_LEVEL_DEBUG, "swap_test", path.string()); Rules::get().FakePoW = true; beam::Height fork1Height = 10; diff --git a/wallet/unittests/swap_test_environment.cpp b/wallet/unittests/swap_test_environment.cpp index eea9eb629..e04cbb0be 100644 --- a/wallet/unittests/swap_test_environment.cpp +++ b/wallet/unittests/swap_test_environment.cpp @@ -78,7 +78,7 @@ class TestBitcoinWallet } else { - LOG_ERROR() << "Server error " << io::error_str(errorCode); + BEAM_LOG_ERROR() << "Server error " << io::error_str(errorCode); //g_stopEvent(); m_reactor.stop(); } @@ -104,7 +104,7 @@ class TestBitcoinWallet } else { - LOG_ERROR() << "Cannot create response"; + BEAM_LOG_ERROR() << "Cannot create response"; //g_stopEvent(); } @@ -117,7 +117,7 @@ class TestBitcoinWallet { if (msg.what != HttpMsgReader::http_message) { - LOG_ERROR() << "TestBitcoinWallet, connection error: " << msg.error_str(); + BEAM_LOG_ERROR() << "TestBitcoinWallet, connection error: " << msg.error_str(); return {}; } @@ -225,7 +225,7 @@ class TestBitcoinWallet } else { - LOG_ERROR() << "Request is wrong"; + BEAM_LOG_ERROR() << "Request is wrong"; //g_stopEvent(); } @@ -391,7 +391,7 @@ class TestElectrumWallet } else { - LOG_ERROR() << "Server error " << io::error_str(errorCode); + BEAM_LOG_ERROR() << "Server error " << io::error_str(errorCode); m_reactor.stop(); } } diff --git a/wallet/unittests/wallet_assets_test.cpp b/wallet/unittests/wallet_assets_test.cpp index dd9c9f5a7..5ffaa64c6 100644 --- a/wallet/unittests/wallet_assets_test.cpp +++ b/wallet/unittests/wallet_assets_test.cpp @@ -59,7 +59,7 @@ void TestAssets() { // // Assets issue // - LOG_INFO() << "\nPreparing for assets test..."; + BEAM_LOG_INFO() << "\nPreparing for assets test..."; beam::io::Reactor::Ptr reactor{beam::io::Reactor::create()}; beam::io::Reactor::Scope scope(*reactor); @@ -83,20 +83,20 @@ void TestAssets() { NodeObserver observer([&](){ const auto cursor = node.get_Processor().m_Cursor; if (cursor.m_Sid.m_Height == Rules::get().pForks[1].m_Height) { - LOG_INFO () << "Reached fork 1..."; + BEAM_LOG_INFO () << "Reached fork 1..."; } if (cursor.m_Sid.m_Height == Rules::get().pForks[2].m_Height) { - LOG_INFO () << "Reached fork 2..."; + BEAM_LOG_INFO () << "Reached fork 2..."; reactor->stop(); return; } if (waitBlock && cursor.m_Sid.m_Height == waitBlock) { - LOG_INFO () << "Reached block " << waitBlock << "..."; + BEAM_LOG_INFO () << "Reached block " << waitBlock << "..."; reactor->stop(); return; } if (cursor.m_Sid.m_Height >= 100) { - LOG_INFO () << "Reached max allowed block..."; + BEAM_LOG_INFO () << "Reached max allowed block..."; WALLET_CHECK(!"Test should complete before block 100. Something went wrong."); reactor->stop(); return; @@ -109,7 +109,7 @@ void TestAssets() { auto ownerDB = createSqliteWalletDB("owner_wallet.db", false, true); TestWalletRig owner(ownerDB, stopReactor, TestWalletRig::RegularWithoutPoWBbs); - LOG_INFO() << "\nStarting node and waiting until fork2..."; + BEAM_LOG_INFO() << "\nStarting node and waiting until fork2..."; reactor->run(); // @@ -125,13 +125,13 @@ void TestAssets() { // storage::Totals totals(*receiverDB, false); const auto mined = AmountBig::get_Lo(totals.GetBeamTotals().Avail); - LOG_INFO() << "Beam mined " << PrintableAmount(mined); + BEAM_LOG_INFO() << "Beam mined " << PrintableAmount(mined); const auto deposit = Rules::get().CA.DepositForList2; const auto fee = Amount(100); const auto initial = Rules::get().CA.DepositForList2 * 2 + fee * 40; // 40 should be enough; - LOG_INFO() << "Beam necessary for test " << PrintableAmount(initial); + BEAM_LOG_INFO() << "Beam necessary for test " << PrintableAmount(initial); WALLET_CHECK(initial <= mined); // @@ -168,7 +168,7 @@ void TestAssets() { TxDescription tx; auto runTest = [&](const char* name, const std::function& test, int wcnt = 1, bool owner = true) { - LOG_INFO() << "\nTesting " << name << "..."; + BEAM_LOG_INFO() << "\nTesting " << name << "..."; helpers::StopWatch sw; sw.start(); @@ -176,7 +176,7 @@ void TestAssets() { const auto txid = test(); reactor->run(); sw.stop(); - LOG_INFO() << name << ", elapsed time: " << sw.milliseconds() << "ms"; + BEAM_LOG_INFO() << name << ", elapsed time: " << sw.milliseconds() << "ms"; auto db = owner ? ownerDB : receiverDB; tx = getTx(db, txid); @@ -216,7 +216,7 @@ void TestAssets() { .SetParameter(TxParameterID::MyAddr, receiver.m_BbsAddr) .SetParameter(TxParameterID::PeerAddr, owner.m_BbsAddr)); }, 2, false); - LOG_INFO() << "Now owner has " << PrintableAmount(storage::Totals(*ownerDB, false).GetBeamTotals().Avail); + BEAM_LOG_INFO() << "Now owner has " << PrintableAmount(storage::Totals(*ownerDB, false).GetBeamTotals().Avail); // fee too small // TODO: Uncomment when we'll create base builder that checks fees. Now it is assumed to be checked by the CLI @@ -633,13 +633,13 @@ void TestAssets() { // // At last we're done! // - LOG_INFO() << "Finished testing assets..."; + BEAM_LOG_INFO() << "Finished testing assets..."; } int main () { - const auto logLevel = LOG_LEVEL_DEBUG; + const auto logLevel = BEAM_LOG_LEVEL_DEBUG; const auto logger = beam::Logger::create(logLevel, logLevel); - LOG_INFO() << "Assets test - starting"; + BEAM_LOG_INFO() << "Assets test - starting"; auto& rules = beam::Rules::get(); WALLET_CHECK(rules.CA.LockPeriod == rules.MaxRollback); @@ -655,7 +655,7 @@ int main () { TestAssets(); - LOG_INFO() << "Assets test - completed, failures: " << g_failureCount; + BEAM_LOG_INFO() << "Assets test - completed, failures: " << g_failureCount; assert(g_failureCount == 0); return WALLET_CHECK_RESULT; } diff --git a/wallet/unittests/wallet_contract_test.cpp b/wallet/unittests/wallet_contract_test.cpp index 307537d6a..dae540bbc 100644 --- a/wallet/unittests/wallet_contract_test.cpp +++ b/wallet/unittests/wallet_contract_test.cpp @@ -310,7 +310,7 @@ void TestContract() int main() { - const auto logLevel = LOG_LEVEL_DEBUG; + const auto logLevel = BEAM_LOG_LEVEL_DEBUG; const auto logger = beam::Logger::create(logLevel, logLevel); io::Reactor::Ptr reactor{ io::Reactor::create() }; io::Reactor::Scope scope(*reactor); diff --git a/wallet/unittests/wallet_db_test.cpp b/wallet/unittests/wallet_db_test.cpp index 51c6572bf..3478b807d 100644 --- a/wallet/unittests/wallet_db_test.cpp +++ b/wallet/unittests/wallet_db_test.cpp @@ -1062,10 +1062,10 @@ vector SelectCoins(IWalletDB::Ptr db, Amount amount, bool printCoins = tru sum += coin.m_ID.m_Value; if (printCoins) { - LOG_INFO() << coin.m_ID.m_Value; + BEAM_LOG_INFO() << coin.m_ID.m_Value; } } - LOG_INFO() << "sum = " << sum << " change = " << sum - amount; + BEAM_LOG_INFO() << "sum = " << sum << " change = " << sum - amount; WALLET_CHECK(amount <= sum); #ifdef NDEBUG WALLET_CHECK(sw.milliseconds() <= 1000); @@ -1706,9 +1706,9 @@ void TestShieldedStatus2() int main() { - int logLevel = LOG_LEVEL_DEBUG; + int logLevel = BEAM_LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif auto logger = beam::Logger::create(logLevel, logLevel); ECC::InitializeContext(); diff --git a/wallet/unittests/wallet_test.cpp b/wallet/unittests/wallet_test.cpp index edd0595bc..fab1c730c 100644 --- a/wallet/unittests/wallet_test.cpp +++ b/wallet/unittests/wallet_test.cpp @@ -4683,7 +4683,7 @@ void TestAddressVersions() // } // else // { -// LOG_ERROR() << "Error, invalid signature :("; +// BEAM_LOG_ERROR() << "Error, invalid signature :("; // } // } //} @@ -4733,7 +4733,7 @@ void TestHWCommitment() WALLET_CHECK(keyKeeper.get_Commitment(pt2, cid) == IPrivateKeyKeeper2::Status::Success); comm1 = pt2; - LOG_INFO() << "commitment is " << comm1; + BEAM_LOG_INFO() << "commitment is " << comm1; { @@ -4762,7 +4762,7 @@ void TestHWCommitment() WALLET_CHECK(keyKeeper->get_Commitment(pt2, cid) == IPrivateKeyKeeper2::Status::Success); comm2 = pt2; - LOG_INFO() << "HW commitment is " << comm2; + BEAM_LOG_INFO() << "HW commitment is " << comm2; { ECC::Point::Native comm3; @@ -4971,9 +4971,9 @@ void TestThreadPool() int main() { - int logLevel = LOG_LEVEL_WARNING; + int logLevel = BEAM_LOG_LEVEL_WARNING; #if LOG_VERBOSE_ENABLED - logLevel = LOG_LEVEL_VERBOSE; + logLevel = BEAM_LOG_LEVEL_VERBOSE; #endif const auto path = boost::filesystem::system_complete("logs"); auto logger = beam::Logger::create(logLevel, logLevel, logLevel, "wallet_test", path.string()); diff --git a/wallet/unittests/wallet_test_environment.cpp b/wallet/unittests/wallet_test_environment.cpp index cb96dc1ee..861604cba 100644 --- a/wallet/unittests/wallet_test_environment.cpp +++ b/wallet/unittests/wallet_test_environment.cpp @@ -1228,7 +1228,7 @@ class TestNode { case DisconnectReason::Protocol: case DisconnectReason::ProcessingExc: - LOG_ERROR() << "Disconnect: " << r; + BEAM_LOG_ERROR() << "Disconnect: " << r; g_failureCount++; default: // suppress warning diff --git a/wasmclient/wasmclient.cpp b/wasmclient/wasmclient.cpp index 645eb82ce..4207b1376 100644 --- a/wasmclient/wasmclient.cpp +++ b/wasmclient/wasmclient.cpp @@ -84,7 +84,7 @@ namespace void HandleException(const std::exception& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); EM_ASM ( { @@ -304,7 +304,7 @@ class WasmAppApiProxy } else { - LOG_ERROR() << "Failed to call API, wallet is not running"; + BEAM_LOG_ERROR() << "Failed to call API, wallet is not running"; } } @@ -317,7 +317,7 @@ class WasmAppApiProxy } else { - LOG_ERROR() << "Failed to set result callback, wallet is not running"; + BEAM_LOG_ERROR() << "Failed to set result callback, wallet is not running"; } } @@ -388,7 +388,7 @@ class WasmWalletClient } WasmWalletClient(const std::string& dbName, const std::string& pass, const std::string& node, Rules::Network network) - : m_Logger(beam::Logger::create(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG)) + : m_Logger(beam::Logger::create(BEAM_LOG_LEVEL_DEBUG, BEAM_LOG_LEVEL_DEBUG)) , m_Reactor(io::Reactor::create()) , m_DbPath(dbName) , m_Pass(pass) @@ -471,7 +471,7 @@ class WasmWalletClient AssertMainThread(); if (!m_Client) { - LOG_ERROR() << "Client is not running"; + BEAM_LOG_ERROR() << "Client is not running"; return; } m_Client->getAsync()->makeIWTCall([this, request]() @@ -552,7 +552,7 @@ class WasmWalletClient AssertMainThread(); if (!m_Client) { - LOG_WARNING() << "The client is stopped"; + BEAM_LOG_WARNING() << "The client is stopped"; return; } m_Client->getAsync()->makeIWTCall([this]() @@ -677,7 +677,7 @@ class WasmWalletClient if (version.empty()) { const std::string errmsg = std::string("Unsupported api version requested: ") + apiver + "/" + minapiver; - LOG_WARNING() << errmsg; + BEAM_LOG_WARNING() << errmsg; cb(errmsg, val::undefined()); return; } @@ -689,7 +689,7 @@ class WasmWalletClient if (!wapi) { const char* errmsg = "CreateAppAPI: failed to create API"; - LOG_WARNING() << errmsg; + BEAM_LOG_WARNING() << errmsg; cb(errmsg, val::undefined()); return; } @@ -749,7 +749,7 @@ class WasmWalletClient AssertMainThread(); if (m_RecoveryCallback) { - LOG_WARNING() << "Recovery is in progress"; + BEAM_LOG_WARNING() << "Recovery is in progress"; return; } try @@ -775,7 +775,7 @@ class WasmWalletClient AssertMainThread(); if (m_RecoveryCallback) { - LOG_WARNING() << "Recovery is in progress"; + BEAM_LOG_WARNING() << "Recovery is in progress"; return; } try @@ -940,12 +940,12 @@ class WasmWalletClient try { Rules::get().UpdateChecksum(); - LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); + BEAM_LOG_INFO() << "Rules signature: " << Rules::get().get_SignatureStr(); return WalletDB::open(dbName, SecString(pass)); } catch (const DatabaseException& ex) { - LOG_ERROR() << ex.what(); + BEAM_LOG_ERROR() << ex.what(); throw; } } @@ -956,7 +956,7 @@ class WasmWalletClient s_MountCB = cb; if (s_Mounted) { - LOG_WARNING() << "File systen is already mounted."; + BEAM_LOG_WARNING() << "File systen is already mounted."; return; } EM_ASM @@ -988,7 +988,7 @@ class WasmWalletClient } else { - LOG_WARNING() << "Callback for mount is not set"; + BEAM_LOG_WARNING() << "Callback for mount is not set"; } } diff --git a/websocket/sessions.cpp b/websocket/sessions.cpp index 515ac125a..4b572c8c9 100644 --- a/websocket/sessions.cpp +++ b/websocket/sessions.cpp @@ -18,7 +18,7 @@ namespace beam { void fail(boost::system::error_code ec, char const* what) { - LOG_ERROR() << what << ": " << ec.message(); + BEAM_LOG_ERROR() << what << ": " << ec.message(); } void failEx(boost::system::error_code ec, char const* what) diff --git a/websocket/unittests/websocket_test.cpp b/websocket/unittests/websocket_test.cpp index 1488e6e56..bfa75b309 100644 --- a/websocket/unittests/websocket_test.cpp +++ b/websocket/unittests/websocket_test.cpp @@ -605,7 +605,7 @@ namespace int main() { - int logLevel = LOG_LEVEL_WARNING; + int logLevel = BEAM_LOG_LEVEL_WARNING; auto logger = beam::Logger::create(logLevel, logLevel); PlainWebsocketTest(); diff --git a/websocket/websocket_server.cpp b/websocket/websocket_server.cpp index dc3644f7c..ff0f96a17 100644 --- a/websocket/websocket_server.cpp +++ b/websocket/websocket_server.cpp @@ -168,7 +168,7 @@ namespace beam ctx.use_tmp_dh_file(options.dhParamsPath); } } - LOG_INFO() << "Listening websocket protocol on port " << options.port; + BEAM_LOG_INFO() << "Listening websocket protocol on port " << options.port; _iocThread = std::make_shared([this, port = options.port, reactor]() { HandlerCreator creator = [this, reactor](WebSocketServer::SendFunc func, WebSocketServer::CloseFunc closeFunc) -> auto @@ -187,12 +187,12 @@ namespace beam WebSocketServer::~WebSocketServer() { - LOG_INFO() << "Stopping websocket server..."; + BEAM_LOG_INFO() << "Stopping websocket server..."; _ioc.stop(); if (_iocThread && _iocThread->joinable()) { _iocThread->join(); } - LOG_INFO() << "Websocket server stopped"; + BEAM_LOG_INFO() << "Websocket server stopped"; } } From 82dcd7c82554f2ac36284bc41d2a4eb25b93416a Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Sun, 5 May 2024 13:59:04 +0300 Subject: [PATCH 2/7] try c++20 --- .../bitcoin/bitcoin/unicode/file_lock.hpp | 10 ++++++---- CMakeLists.txt | 4 ++-- keykeeper/CMakeLists.txt | 2 +- mnemonic/mnemonic.cpp | 12 +++++------ utility/CMakeLists.txt | 2 +- wallet/client/CMakeLists.txt | 4 ++-- .../broadcast_gateway/CMakeLists.txt | 2 +- .../extensions/dex_board/CMakeLists.txt | 2 +- .../client/extensions/export/CMakeLists.txt | 2 +- .../extensions/news_channels/CMakeLists.txt | 2 +- .../extensions/notifications/CMakeLists.txt | 2 +- .../extensions/offers_board/CMakeLists.txt | 2 +- wallet/core/CMakeLists.txt | 2 +- wallet/unittests/wallet_db_test.cpp | 20 +++++++++---------- wasmclient/CMakeLists.txt | 2 +- websocket/CMakeLists.txt | 2 +- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/3rdparty/libbitcoin/include/bitcoin/bitcoin/unicode/file_lock.hpp b/3rdparty/libbitcoin/include/bitcoin/bitcoin/unicode/file_lock.hpp index c165aee5c..7fbee47a3 100644 --- a/3rdparty/libbitcoin/include/bitcoin/bitcoin/unicode/file_lock.hpp +++ b/3rdparty/libbitcoin/include/bitcoin/bitcoin/unicode/file_lock.hpp @@ -32,6 +32,10 @@ // Includes from bitcoin/unicode.hpp under _MSC_VER. #include +#ifdef _MSC_VER +#include +#endif + //!\file //!Describes a class that wraps file locking capabilities. @@ -155,13 +159,11 @@ class file_lock #ifdef _MSC_VER -extern "C" __declspec(dllimport) void * __stdcall CreateFileW(const wchar_t *, unsigned long, unsigned long, struct boost::interprocess::winapi::interprocess_security_attributes*, unsigned long, unsigned long, void *); - // ENABLE UNICODE PATHS ON WINDOWS FROM UTF8 STRING REGARDLESS OF BUILD CONFIGURATION. inline void* CreateFileUTF8(const std::string& name, unsigned long access, unsigned long mode, - struct boost::interprocess::winapi::interprocess_security_attributes *psec, unsigned long creation, unsigned long attributes, void *ptemplate) + boost::interprocess::winapi::interprocess_security_attributes *psec, unsigned long creation, unsigned long attributes, void *ptemplate) { - return libbitcoin::interprocess::CreateFileW(bc::to_utf16(name).c_str(), access, mode, psec, creation, attributes, ptemplate); + return boost::winapi::CreateFileW(bc::to_utf16(name).c_str(), access, mode, psec, creation, attributes, ptemplate); } // ADAPTED FROM boost/interprocess/winapi/win32_api.hpp UNDER SAME LICENSE AS ABOVE. diff --git a/CMakeLists.txt b/CMakeLists.txt index e4fc6ed38..2437f7427 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ target_include_directories(beam INTERFACE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/3rdparty) -target_compile_features(beam INTERFACE cxx_std_17) +target_compile_features(beam INTERFACE cxx_std_20) file(WRITE ${PROJECT_SOURCE_DIR}/beam_version.gen "${PROJECT_VERSION}") @@ -121,7 +121,7 @@ endif() include(AddTest) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(BEAM_USE_AVX FALSE) diff --git a/keykeeper/CMakeLists.txt b/keykeeper/CMakeLists.txt index 62a3eca45..4bdacd8af 100644 --- a/keykeeper/CMakeLists.txt +++ b/keykeeper/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13) set(TARGET_NAME wasm-key-keeper) if(EMSCRIPTEN) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() diff --git a/mnemonic/mnemonic.cpp b/mnemonic/mnemonic.cpp index e2783cef6..a08e157fa 100644 --- a/mnemonic/mnemonic.cpp +++ b/mnemonic/mnemonic.cpp @@ -20,8 +20,6 @@ #include #include -using namespace std; - namespace beam { namespace @@ -83,7 +81,7 @@ namespace beam std::vector decodeMnemonic(const WordList& words) { - const std::string sentence = boost::join(words, " "); + const auto sentence = boost::join(words, " "); std::vector passphrase(sentence.begin(), sentence.end()); std::vector salt(passphrasePrefix.begin(), passphrasePrefix.end()); std::vector hash(sizeHash); @@ -103,17 +101,17 @@ namespace beam return hash; } - bool isAllowedWord(const string& word, const Dictionary& dict) + bool isAllowedWord(const std::string& word, const Dictionary& dict) { auto predicate = [] (const char* left, const char* right) { return strcmp(left, right) < 0; }; - assert(is_sorted(dict.begin(), dict.end(), predicate)); - return binary_search(dict.begin(), dict.end(), word.c_str(), predicate); + assert(std::is_sorted(dict.begin(), dict.end(), predicate)); + return std::binary_search(dict.begin(), dict.end(), word.c_str(), predicate); } bool isValidMnemonic(const WordList& words, const Dictionary& dict) { - return words.size() == WORD_COUNT && all_of(words.begin(), words.end(), [&dict](const string& w) {return isAllowedWord(w, dict); }); + return words.size() == WORD_COUNT && std::all_of(words.begin(), words.end(), [&dict](const std::string& w) {return isAllowedWord(w, dict); }); } } diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt index 37792a1ed..74c68c538 100644 --- a/utility/CMakeLists.txt +++ b/utility/CMakeLists.txt @@ -54,7 +54,7 @@ if (MSVC) endif() add_library(utility STATIC ${UTILITY_SRC} ${IO_SRC}) -target_compile_features(utility PUBLIC cxx_std_17) +target_compile_features(utility PUBLIC cxx_std_20) if (NOT EMSCRIPTEN) add_library(cli STATIC ${CLI_SRC}) diff --git a/wallet/client/CMakeLists.txt b/wallet/client/CMakeLists.txt index 7cf45e01d..f6d5d7e32 100644 --- a/wallet/client/CMakeLists.txt +++ b/wallet/client/CMakeLists.txt @@ -33,8 +33,8 @@ target_link_libraries(wallet_client_no_ipfs PRIVATE http ) -target_compile_features(wallet_client PUBLIC cxx_std_17) -target_compile_features(wallet_client_no_ipfs PUBLIC cxx_std_17) +target_compile_features(wallet_client PUBLIC cxx_std_20) +target_compile_features(wallet_client_no_ipfs PUBLIC cxx_std_20) add_subdirectory(extensions) diff --git a/wallet/client/extensions/broadcast_gateway/CMakeLists.txt b/wallet/client/extensions/broadcast_gateway/CMakeLists.txt index 5172f9398..34ee8ba06 100644 --- a/wallet/client/extensions/broadcast_gateway/CMakeLists.txt +++ b/wallet/client/extensions/broadcast_gateway/CMakeLists.txt @@ -18,5 +18,5 @@ target_link_libraries(broadcast_gateway wallet_core ) -target_compile_features(broadcast_gateway PUBLIC cxx_std_17) +target_compile_features(broadcast_gateway PUBLIC cxx_std_20) diff --git a/wallet/client/extensions/dex_board/CMakeLists.txt b/wallet/client/extensions/dex_board/CMakeLists.txt index d84b7c0b9..c9a69d59c 100644 --- a/wallet/client/extensions/dex_board/CMakeLists.txt +++ b/wallet/client/extensions/dex_board/CMakeLists.txt @@ -16,5 +16,5 @@ target_link_libraries(dex_board wallet ) -target_compile_features(dex_board PUBLIC cxx_std_17) +target_compile_features(dex_board PUBLIC cxx_std_20) diff --git a/wallet/client/extensions/export/CMakeLists.txt b/wallet/client/extensions/export/CMakeLists.txt index 04b9616fd..cc3f44138 100644 --- a/wallet/client/extensions/export/CMakeLists.txt +++ b/wallet/client/extensions/export/CMakeLists.txt @@ -21,5 +21,5 @@ if(BEAM_ATOMIC_SWAP_SUPPORT) target_compile_definitions(export PUBLIC BEAM_ATOMIC_SWAP_SUPPORT) endif() -target_compile_features(export PUBLIC cxx_std_17) +target_compile_features(export PUBLIC cxx_std_20) diff --git a/wallet/client/extensions/news_channels/CMakeLists.txt b/wallet/client/extensions/news_channels/CMakeLists.txt index b1645e9e4..3751390ce 100644 --- a/wallet/client/extensions/news_channels/CMakeLists.txt +++ b/wallet/client/extensions/news_channels/CMakeLists.txt @@ -24,5 +24,5 @@ target_link_libraries(news_channels wallet_core ) -target_compile_features(news_channels PUBLIC cxx_std_17) +target_compile_features(news_channels PUBLIC cxx_std_20) diff --git a/wallet/client/extensions/notifications/CMakeLists.txt b/wallet/client/extensions/notifications/CMakeLists.txt index 37b49ddb0..f19e2849d 100644 --- a/wallet/client/extensions/notifications/CMakeLists.txt +++ b/wallet/client/extensions/notifications/CMakeLists.txt @@ -17,5 +17,5 @@ target_link_libraries(notifications wallet_core ) -target_compile_features(notifications PUBLIC cxx_std_17) +target_compile_features(notifications PUBLIC cxx_std_20) diff --git a/wallet/client/extensions/offers_board/CMakeLists.txt b/wallet/client/extensions/offers_board/CMakeLists.txt index bd2ec40cd..5faa01ab5 100644 --- a/wallet/client/extensions/offers_board/CMakeLists.txt +++ b/wallet/client/extensions/offers_board/CMakeLists.txt @@ -22,5 +22,5 @@ target_link_libraries(swap_offers_board wallet ) -target_compile_features(swap_offers_board PUBLIC cxx_std_17) +target_compile_features(swap_offers_board PUBLIC cxx_std_20) diff --git a/wallet/core/CMakeLists.txt b/wallet/core/CMakeLists.txt index dd7b1bcf1..6c14251af 100644 --- a/wallet/core/CMakeLists.txt +++ b/wallet/core/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(wallet_core sqlite ) -target_compile_features(wallet_core PUBLIC cxx_std_17) +target_compile_features(wallet_core PUBLIC cxx_std_20) if (NOT ANDROID AND NOT IOS) diff --git a/wallet/unittests/wallet_db_test.cpp b/wallet/unittests/wallet_db_test.cpp index 3478b807d..facfc4f97 100644 --- a/wallet/unittests/wallet_db_test.cpp +++ b/wallet/unittests/wallet_db_test.cpp @@ -219,29 +219,29 @@ void TestStoreCoins() - int coinBase = 0; - int comission = 0; - int regular = 0; - walletDB->visitCoins([&coinBase, &comission, ®ular](const Coin& coin)->bool + int coinbase_count = 0; + int comission_count = 0; + int regular_count = 0; + walletDB->visitCoins([&coinbase_count, &comission_count, ®ular_count](const Coin& coin)->bool { if (coin.m_ID.m_Type == Key::Type::Coinbase) { - ++coinBase; + ++coinbase_count; } else if (coin.m_ID.m_Type == Key::Type::Comission) { - ++comission; + ++comission_count; } else if (coin.m_ID.m_Type == Key::Type::Regular) { - ++regular; + ++regular_count; } return true; }); - WALLET_CHECK(coinBase == 6); - WALLET_CHECK(comission == 6); - WALLET_CHECK(regular == 10); + WALLET_CHECK(coinbase_count == 6); + WALLET_CHECK(comission_count == 6); + WALLET_CHECK(regular_count == 10); coins.clear(); walletDB->visitCoins([&coins](const auto& coin)->bool diff --git a/wasmclient/CMakeLists.txt b/wasmclient/CMakeLists.txt index f6950e03b..f02519308 100644 --- a/wasmclient/CMakeLists.txt +++ b/wasmclient/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13) set(TARGET_NAME wasm-client) if(EMSCRIPTEN) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-value \ -pthread \ diff --git a/websocket/CMakeLists.txt b/websocket/CMakeLists.txt index 9edcb6c64..cf0535876 100644 --- a/websocket/CMakeLists.txt +++ b/websocket/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries(websocket beam ) -target_compile_definitions(websocket PUBLIC _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +target_compile_definitions(websocket PUBLIC _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) if(MSVC) # to avoid 4702 warning here, until another workaround will be found From 7f1ea44183f7cd42758be1ead7f2f5ff261cd9ab Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Sun, 5 May 2024 18:02:08 +0300 Subject: [PATCH 3/7] WIP: tests refactoring fixed atomic_swap.cpp --- 3rdparty/libbitcoin/examples/atomic_swap.cpp | 17 +- .../examples/electrum_get_balance.cpp | 51 +++-- .../libbitcoin/examples/ethereum_example.cpp | 210 +++++++++--------- 3rdparty/libbitcoin/examples/get_info.cpp | 102 ++++----- 3rdparty/libbitcoin/examples/sign_tx.cpp | 87 ++++---- 5 files changed, 243 insertions(+), 224 deletions(-) diff --git a/3rdparty/libbitcoin/examples/atomic_swap.cpp b/3rdparty/libbitcoin/examples/atomic_swap.cpp index a7f6fea3e..c9e1252a6 100644 --- a/3rdparty/libbitcoin/examples/atomic_swap.cpp +++ b/3rdparty/libbitcoin/examples/atomic_swap.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Beam Team +// Copyright 2018-2024 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -543,13 +543,16 @@ void testAtomicSwap(const boost::program_options::variables_map& vm) reactor->run(); } -int main(int argc, char* argv[]) { - int logLevel = BEAM_LOG_LEVEL_DEBUG; +int main(int argc, char* argv[]) try { + int logLevel{}; + #if LOG_VERBOSE_ENABLED logLevel = BEAM_LOG_LEVEL_VERBOSE; +#else + logLevel = BEAM_LOG_LEVEL_DEBUG; #endif - auto logger = Logger::create(logLevel, logLevel); + auto logger = Logger::create(logLevel, logLevel); /* -create senderAddress receiverAddress secretStr amount locktime -refund address txID amount locktime outputIndex redeemscript @@ -614,4 +617,8 @@ int main(int argc, char* argv[]) { testAtomicSwap(vm); return 0; -} \ No newline at end of file +} +catch (const std::exception& e) { + BEAM_LOG_ERROR() << e.what(); + return 0; +} diff --git a/3rdparty/libbitcoin/examples/electrum_get_balance.cpp b/3rdparty/libbitcoin/examples/electrum_get_balance.cpp index 99fc0201f..2271cd0dd 100644 --- a/3rdparty/libbitcoin/examples/electrum_get_balance.cpp +++ b/3rdparty/libbitcoin/examples/electrum_get_balance.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Beam Team +// Copyright 2018-2024 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -90,32 +90,37 @@ namespace } } -int main() { - int logLevel = BEAM_LOG_LEVEL_DEBUG; +int main() try { + int logLevel{}; + #if LOG_VERBOSE_ENABLED logLevel = BEAM_LOG_LEVEL_VERBOSE; +#else + logLevel = BEAM_LOG_LEVEL_DEBUG; #endif + auto logger = Logger::create(logLevel, logLevel); + io::Reactor::Ptr reactor = io::Reactor::create(); + io::Reactor::Scope scope(*reactor); + Address address; - try { - io::Reactor::Ptr reactor = io::Reactor::create(); - io::Reactor::Scope scope(*reactor); - - Address address; - /*address.resolve("testnet.hsmiths.com"); - address.port(53012);*/ - - /*address.resolve("testnet.qtornado.com"); - address.port(51002);*/ - address.resolve("testnet1.bauerj.eu"); - address.port(50002); - - reactor->tcp_connect(address, tag_ok, on_connected, 2000, io::TlsConfig(true)); - reactor->run(); - } - catch (const std::exception& e) { - BEAM_LOG_ERROR() << e.what(); - } +#if 0 + address.resolve("testnet.hsmiths.com"); + address.port(53012); + + address.resolve("testnet.qtornado.com"); + address.port(51002); +#endif + + address.resolve("testnet1.bauerj.eu"); + address.port(50002); + + reactor->tcp_connect(address, tag_ok, on_connected, 2000, io::TlsConfig(true)); + reactor->run(); return 0; -} \ No newline at end of file +} +catch (const std::exception& e) { + BEAM_LOG_ERROR() << e.what(); + return 0; +} diff --git a/3rdparty/libbitcoin/examples/ethereum_example.cpp b/3rdparty/libbitcoin/examples/ethereum_example.cpp index 6f266f03e..737018fe2 100644 --- a/3rdparty/libbitcoin/examples/ethereum_example.cpp +++ b/3rdparty/libbitcoin/examples/ethereum_example.cpp @@ -1,15 +1,15 @@ -// Copyright 2020 The Beam Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and +// Copyright 2018-2024 The Beam Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and // limitations under the License. #include @@ -23,83 +23,83 @@ libbitcoin::wallet::hd_private ProcessHDPrivate(const libbitcoin::wallet::hd_private& privateKey, uint32_t index, bool hard = true) { - static constexpr auto first = libbitcoin::wallet::hd_first_hardened_key; - const auto position = hard ? first + index : index; + static constexpr auto first = libbitcoin::wallet::hd_first_hardened_key; + const auto position = hard ? first + index : index; return privateKey.derive_private(position); } -template -unsigned BytesRequired(T value) -{ - static_assert(!std::numeric_limits::is_signed, "only unsigned types supported"); - unsigned i = 0; - for (; value != 0; ++i, value >>= 8) - { - } - return i; +template +unsigned BytesRequired(T value) +{ + static_assert(!std::numeric_limits::is_signed, "only unsigned types supported"); + unsigned i = 0; + for (; value != 0; ++i, value >>= 8) + { + } + return i; } -unsigned BytesRequired(ECC::uintBig input) -{ - unsigned n = 0; - for (; input != ECC::Zero; ++n, input.ShiftRight(8, input)) - { - } - return n; +unsigned BytesRequired(ECC::uintBig input) +{ + unsigned n = 0; + for (; input != ECC::Zero; ++n, input.ShiftRight(8, input)) + { + } + return n; } -class RLPStream -{ -public: - RLPStream() {} - ~RLPStream() {} - - /// Append given datum to the byte stream. - RLPStream& append(unsigned value) { return append(ECC::uintBig(value)); } - RLPStream& append(const ECC::uintBig& value); - RLPStream& append(const beam::ByteBuffer& value); - RLPStream& append(const libbitcoin::short_hash& value); - - /// Shift operators for appending data items. - template RLPStream& operator<<(T _data) { return append(_data); } - - // return finallized list(compute and add full size of list before data) - beam::ByteBuffer out() const; - - // Clear the output stream. - void clear() { m_out.clear(); } - -private: - static const uint8_t kRLPDataLenStart = 0x80; - - beam::ByteBuffer EncodeLength(size_t size, uint8_t offset = kRLPDataLenStart) const; - - beam::ByteBuffer m_out; +class RLPStream +{ +public: + RLPStream() {} + ~RLPStream() {} + + /// Append given datum to the byte stream. + RLPStream& append(unsigned value) { return append(ECC::uintBig(value)); } + RLPStream& append(const ECC::uintBig& value); + RLPStream& append(const beam::ByteBuffer& value); + RLPStream& append(const libbitcoin::short_hash& value); + + /// Shift operators for appending data items. + template RLPStream& operator<<(T _data) { return append(_data); } + + // return finallized list(compute and add full size of list before data) + beam::ByteBuffer out() const; + + // Clear the output stream. + void clear() { m_out.clear(); } + +private: + static const uint8_t kRLPDataLenStart = 0x80; + + beam::ByteBuffer EncodeLength(size_t size, uint8_t offset = kRLPDataLenStart) const; + + beam::ByteBuffer m_out; }; -RLPStream& RLPStream::append(const ECC::uintBig& value) -{ - if (value == ECC::Zero) - { - m_out.push_back(0x80); - } - else - { - auto bytesRequired = BytesRequired(value); - - // For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding - if (bytesRequired == 1 && value.m_pData[ECC::uintBig::nBytes - 1] < 0x80) - { - m_out.push_back(value.m_pData[ECC::uintBig::nBytes - 1]); - } - else - { - m_out.reserve(m_out.size() + bytesRequired + 1); - m_out.push_back(static_cast(kRLPDataLenStart + bytesRequired)); - m_out.insert(m_out.end(), std::end(value.m_pData) - bytesRequired, std::end(value.m_pData)); - } - } - return *this; +RLPStream& RLPStream::append(const ECC::uintBig& value) +{ + if (value == ECC::Zero) + { + m_out.push_back(0x80); + } + else + { + auto bytesRequired = BytesRequired(value); + + // For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding + if (bytesRequired == 1 && value.m_pData[ECC::uintBig::nBytes - 1] < 0x80) + { + m_out.push_back(value.m_pData[ECC::uintBig::nBytes - 1]); + } + else + { + m_out.reserve(m_out.size() + bytesRequired + 1); + m_out.push_back(static_cast(kRLPDataLenStart + bytesRequired)); + m_out.insert(m_out.end(), std::end(value.m_pData) - bytesRequired, std::end(value.m_pData)); + } + } + return *this; } RLPStream& RLPStream::append(const beam::ByteBuffer& value) @@ -122,9 +122,9 @@ RLPStream& RLPStream::append(const beam::ByteBuffer& value) RLPStream& RLPStream::append(const libbitcoin::short_hash& value) { auto valueSize = value.size(); - - m_out.reserve(m_out.size() + valueSize + 1); - m_out.push_back(static_cast(kRLPDataLenStart + valueSize)); + + m_out.reserve(m_out.size() + valueSize + 1); + m_out.push_back(static_cast(kRLPDataLenStart + valueSize)); m_out.insert(m_out.end(), value.begin(), value.end()); return *this; } @@ -154,7 +154,7 @@ beam::ByteBuffer RLPStream::EncodeLength(size_t size, uint8_t offset) const // The range of the first byte is thus [0xb8, 0xbf] or [0xf8, 0xff] for list. out.front() = bytesRequired + offset + kRLPSmallDataLengthLimit; - auto b = out.end(); + auto b = out.end(); for (; size; size >>= 8) { *(--b) = static_cast(size & 0xff); @@ -167,22 +167,22 @@ beam::ByteBuffer RLPStream::EncodeLength(size_t size, uint8_t offset) const return beam::ByteBuffer{ static_cast(size + offset) }; } -struct EthTransactionSkeleton -{ - libbitcoin::short_hash m_from; - libbitcoin::short_hash m_receiveAddress; - ECC::uintBig m_value = ECC::Zero; - beam::ByteBuffer m_data; - ECC::uintBig m_nonce = ECC::Zero; - ECC::uintBig m_gas = ECC::Zero; - ECC::uintBig m_gasPrice = ECC::Zero; - - // sign_recoverable - // RLPEncode: m_nonce << m_gasPrice << m_gas << m_receiveAddress << m_value << m_data << *m_chainId << 0 << 0; - - beam::ByteBuffer GetRawSigned(const libbitcoin::ec_secret& secret); - - libbitcoin::recoverable_signature Sign(const libbitcoin::ec_secret& secret); +struct EthTransactionSkeleton +{ + libbitcoin::short_hash m_from; + libbitcoin::short_hash m_receiveAddress; + ECC::uintBig m_value = ECC::Zero; + beam::ByteBuffer m_data; + ECC::uintBig m_nonce = ECC::Zero; + ECC::uintBig m_gas = ECC::Zero; + ECC::uintBig m_gasPrice = ECC::Zero; + + // sign_recoverable + // RLPEncode: m_nonce << m_gasPrice << m_gas << m_receiveAddress << m_value << m_data << *m_chainId << 0 << 0; + + beam::ByteBuffer GetRawSigned(const libbitcoin::ec_secret& secret); + + libbitcoin::recoverable_signature Sign(const libbitcoin::ec_secret& secret); }; beam::ByteBuffer EthTransactionSkeleton::GetRawSigned(const libbitcoin::ec_secret& secret) @@ -231,7 +231,7 @@ void GenerateAddress(uint32_t index) auto seed = libbitcoin::wallet::decode_mnemonic(words); libbitcoin::data_chunk seed_chunk(libbitcoin::to_chunk(seed)); - const auto prefixes = libbitcoin::wallet::hd_private::to_prefixes(0, 0); + const auto prefixes = libbitcoin::wallet::hd_private::to_prefixes(0, 0); libbitcoin::wallet::hd_private private_key(seed_chunk, prefixes); private_key = ProcessHDPrivate(private_key, 44); @@ -310,7 +310,7 @@ void TestTxToRLPFull() std::cout << "tx data: " << libbitcoin::encode_base16(tx.GetRawSigned(secret)) << "\n"; } -int main() +int main() try { TestTxToRLP(); TestTxToRLPFull(); @@ -318,4 +318,8 @@ int main() GenerateAddress(1); return 0; -} \ No newline at end of file +} +catch (const std::exception& e) { + std::cerr << e.what(); + return 0; +} diff --git a/3rdparty/libbitcoin/examples/get_info.cpp b/3rdparty/libbitcoin/examples/get_info.cpp index aff77f2dc..f1f900f48 100644 --- a/3rdparty/libbitcoin/examples/get_info.cpp +++ b/3rdparty/libbitcoin/examples/get_info.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Beam Team +// Copyright 2018-2024 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,60 +31,60 @@ namespace const uint16_t PORT = 18443; } -int main() { - int logLevel = BEAM_LOG_LEVEL_DEBUG; +int main() try { + int logLevel{}; + #if LOG_VERBOSE_ENABLED logLevel = BEAM_LOG_LEVEL_VERBOSE; +#else + logLevel = BEAM_LOG_LEVEL_DEBUG; #endif - auto logger = Logger::create(logLevel, logLevel); - - try { - io::Reactor::Ptr reactor = io::Reactor::create(); - HttpClient client(*reactor); - - { - std::string userWithPass("test:123"); - libbitcoin::data_chunk t(userWithPass.begin(), userWithPass.end()); - std::string auth("Basic " + libbitcoin::encode_base64(t)); - std::string_view authView(auth); - static const HeaderPair headers[] = { - //{"Host", "127.0.0.1" }, - //{"Connection", "close"}, - {"Authorization", authView.data()} - }; - const char *data = "{\"method\":\"getblockchaininfo\",\"params\":[]}\n"; - - HttpClient::Request request; - io::Address a(io::Address::localhost(), PORT); - - request.address(a); - request.connectTimeoutMsec(2000); - request.pathAndQuery("/"); - request.headers(headers); - request.numHeaders(1); - request.method("POST"); - request.body(data, strlen(data)); - - request.callback([&reactor](uint64_t id, const HttpMsgReader::Message& msg) -> bool { - BEAM_LOG_INFO() << "response from " << id; - size_t sz = 0; - const void* body = msg.msg->get_body(sz); - json j = json::parse(std::string(static_cast(body), sz)); - BEAM_LOG_INFO() << j; - BEAM_LOG_INFO() << j["result"]["headers"]; - reactor->stop(); - return false; - }); - - client.send_request(request); - } - - reactor->run(); - } - catch (const std::exception& e) { - BEAM_LOG_ERROR() << e.what(); + auto logger = Logger::create(logLevel, logLevel); + io::Reactor::Ptr reactor = io::Reactor::create(); + HttpClient client(*reactor); + { + std::string userWithPass("test:123"); + libbitcoin::data_chunk t(userWithPass.begin(), userWithPass.end()); + std::string auth("Basic " + libbitcoin::encode_base64(t)); + std::string_view authView(auth); + static const HeaderPair headers[] = { + //{"Host", "127.0.0.1" }, + //{"Connection", "close"}, + {"Authorization", authView.data()} + }; + const char *data = "{\"method\":\"getblockchaininfo\",\"params\":[]}\n"; + + HttpClient::Request request; + io::Address a(io::Address::localhost(), PORT); + + request.address(a); + request.connectTimeoutMsec(2000); + request.pathAndQuery("/"); + request.headers(headers); + request.numHeaders(1); + request.method("POST"); + request.body(data, strlen(data)); + + request.callback([&reactor](uint64_t id, const HttpMsgReader::Message& msg) -> bool { + BEAM_LOG_INFO() << "response from " << id; + size_t sz = 0; + const void* body = msg.msg->get_body(sz); + json j = json::parse(std::string(static_cast(body), sz)); + + BEAM_LOG_INFO() << j; + BEAM_LOG_INFO() << j["result"]["headers"]; + reactor->stop(); + return false; + }); + + client.send_request(request); } + reactor->run(); return 0; -} \ No newline at end of file +} +catch (const std::exception& e) { + BEAM_LOG_ERROR() << e.what(); + return 0; +} diff --git a/3rdparty/libbitcoin/examples/sign_tx.cpp b/3rdparty/libbitcoin/examples/sign_tx.cpp index df6d50d7e..7cacf7bd9 100644 --- a/3rdparty/libbitcoin/examples/sign_tx.cpp +++ b/3rdparty/libbitcoin/examples/sign_tx.cpp @@ -1,52 +1,55 @@ -// Copyright 2018 The Beam Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and +// Copyright 2018-2024 The Beam Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and // limitations under the License. #include #include - -int main() +int main() try { - libbitcoin::data_chunk tx_data; + libbitcoin::data_chunk tx_data; libbitcoin::decode_base16(tx_data, "0200000001c18f05d42f69b2d0acf28e2eb2b992089f2ceb3cec83d20a837a493310fd60bc0100000000ffffffff01804a5d050000000017a914f1d14226a785b27796701e4bdeb5a620aa6ea7998700000000"); - libbitcoin::chain::transaction tx; - tx.from_data(tx_data); - - libbitcoin::chain::script prevoutScript; - prevoutScript.from_string("checksig"); - - auto tmp = libbitcoin::base58_literal("cQSg1yRWuKNHZnpVHKECdVoDnafJN6hUeyTPD48Q5S4DEbUH4nkN"); - libbitcoin::wallet::ec_private ecPrivate(tmp, libbitcoin::wallet::ec_private::testnet_wif); - libbitcoin::ec_secret secret = ecPrivate.secret(); - //const libbitcoin::ec_secret secret = libbitcoin::hash_literal("cQSg1yRWuKNHZnpVHKECdVoDnafJN6hUeyTPD48Q5S4DEbUH4nkN"); - - libbitcoin::endorsement sign; - - libbitcoin::chain::script::create_endorsement(sign, secret, prevoutScript, tx, 0, libbitcoin::machine::sighash_algorithm::all); - - libbitcoin::chain::script::operation::list sigScriptOp; - sigScriptOp.push_back(libbitcoin::chain::script::operation(sign)); - sigScriptOp.push_back(libbitcoin::chain::script::operation(libbitcoin::to_chunk(ecPrivate.to_public().encoded()))); - - - tx.inputs()[0].set_script(libbitcoin::chain::script(sigScriptOp)); - - //libbitcoin::chain::script::verify(tc) - - std::cout << libbitcoin::encode_base16(sign) << " " << ecPrivate.to_public() << std::endl; - + libbitcoin::chain::transaction tx; + tx.from_data(tx_data); + + libbitcoin::chain::script prevoutScript; + prevoutScript.from_string("checksig"); + + auto tmp = libbitcoin::base58_literal("cQSg1yRWuKNHZnpVHKECdVoDnafJN6hUeyTPD48Q5S4DEbUH4nkN"); + libbitcoin::wallet::ec_private ecPrivate(tmp, libbitcoin::wallet::ec_private::testnet_wif); + libbitcoin::ec_secret secret = ecPrivate.secret(); + //const libbitcoin::ec_secret secret = libbitcoin::hash_literal("cQSg1yRWuKNHZnpVHKECdVoDnafJN6hUeyTPD48Q5S4DEbUH4nkN"); + + libbitcoin::endorsement sign; + + libbitcoin::chain::script::create_endorsement(sign, secret, prevoutScript, tx, 0, libbitcoin::machine::sighash_algorithm::all); + + libbitcoin::chain::script::operation::list sigScriptOp; + sigScriptOp.push_back(libbitcoin::chain::script::operation(sign)); + sigScriptOp.push_back(libbitcoin::chain::script::operation(libbitcoin::to_chunk(ecPrivate.to_public().encoded()))); + + + tx.inputs()[0].set_script(libbitcoin::chain::script(sigScriptOp)); + + //libbitcoin::chain::script::verify(tc) + + std::cout << libbitcoin::encode_base16(sign) << " " << ecPrivate.to_public() << std::endl; + std::cout << libbitcoin::encode_base16(tx.to_data()); return 0; -} \ No newline at end of file +} +catch (const std::exception& e) { + std::cerr << e.what(); + return 0; +} From b5355e71dc70d9e6f1a513278e5e02c3c20e3747 Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Sun, 5 May 2024 18:09:36 +0300 Subject: [PATCH 4/7] (c)'ts --- mnemonic/mnemonic.cpp | 2 +- wallet/unittests/wallet_db_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mnemonic/mnemonic.cpp b/mnemonic/mnemonic.cpp index a08e157fa..d35f264b2 100644 --- a/mnemonic/mnemonic.cpp +++ b/mnemonic/mnemonic.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Beam Team +// Copyright 2018-2024 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/wallet/unittests/wallet_db_test.cpp b/wallet/unittests/wallet_db_test.cpp index facfc4f97..8913213e3 100644 --- a/wallet/unittests/wallet_db_test.cpp +++ b/wallet/unittests/wallet_db_test.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Beam Team +// Copyright 2018-2024 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From a44885a3281410c0a7e95a803e4bbb4633daffe8 Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Sun, 5 May 2024 19:01:40 +0300 Subject: [PATCH 5/7] README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3175a7ca8..cd1592835 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Read the [Contribution Guide](https://github.com/BeamMW/beam/wiki/Contribution-G Get Beam binaries here: http://beam.mw/downloads -Boostrap nodes: +Bootstrap nodes: eu-nodes.mainnet.beam.mw:8100 From 217ddc6de85149ce91050aea6d6e9010853091fd Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Mon, 6 May 2024 21:19:34 +0300 Subject: [PATCH 6/7] strict c++20 (this capture) --- 3rdparty/libbitcoin/src/chain/transaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/libbitcoin/src/chain/transaction.cpp b/3rdparty/libbitcoin/src/chain/transaction.cpp index 4cc3e42f1..6763fe327 100644 --- a/3rdparty/libbitcoin/src/chain/transaction.cpp +++ b/3rdparty/libbitcoin/src/chain/transaction.cpp @@ -738,7 +738,7 @@ bool transaction::all_inputs_final() const bool transaction::is_final(size_t block_height, uint32_t block_time) const { - const auto max_locktime = [=]() + const auto max_locktime = [=, this]() { return locktime_ < locktime_threshold ? safe_unsigned(block_height) : block_time; From de606fe89a042f67270232c7b3c04298e5bdd964 Mon Sep 17 00:00:00 2001 From: Chuushouka no Tatsujin Date: Fri, 10 May 2024 14:57:00 +0300 Subject: [PATCH 7/7] fixed ; --- wallet/laser/mediator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/laser/mediator.cpp b/wallet/laser/mediator.cpp index 1a331507a..6aa2575bc 100644 --- a/wallet/laser/mediator.cpp +++ b/wallet/laser/mediator.cpp @@ -410,7 +410,7 @@ bool Mediator::Close(const std::string& channelID) if (channel->get_State() != Lightning::Channel::State::Open) { BEAM_LOG_ERROR() << "Previous action with channel: " << channelID - << " is unfinished. Please, listen to this channel until action is complete." + << " is unfinished. Please, listen to this channel until action is complete."; return false; }