From 9fd5cd303d701f07522b1891fe85b170af7a3154 Mon Sep 17 00:00:00 2001 From: seelabs Date: Tue, 1 Jun 2021 15:07:39 -0400 Subject: [PATCH] Do not use __func__ inside lambdas --- src/ripple/app/reporting/ETLSource.cpp | 8 ++++---- src/ripple/app/reporting/ReportingETL.cpp | 4 ++-- src/ripple/nodestore/impl/Database.cpp | 8 ++++---- src/ripple/nodestore/impl/DatabaseShardImp.cpp | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ripple/app/reporting/ETLSource.cpp b/src/ripple/app/reporting/ETLSource.cpp index d470526120..2a249cd878 100644 --- a/src/ripple/app/reporting/ETLSource.cpp +++ b/src/ripple/app/reporting/ETLSource.cpp @@ -110,9 +110,9 @@ ETLSource::reconnect(boost::beast::error_code ec) size_t waitTime = std::min(pow(2, numFailures_), 30.0); numFailures_++; timer_.expires_after(boost::asio::chrono::seconds(waitTime)); - timer_.async_wait([this](auto ec) { + timer_.async_wait([this, fname = __func__](auto ec) { bool startAgain = (ec != boost::asio::error::operation_aborted); - JLOG(journal_.trace()) << __func__ << " async_wait : ec = " << ec; + JLOG(journal_.trace()) << fname << " async_wait : ec = " << ec; close(startAgain); }); } @@ -133,11 +133,11 @@ ETLSource::close(bool startAgain) closing_ = true; ws_->async_close( boost::beast::websocket::close_code::normal, - [this, startAgain](auto ec) { + [this, startAgain, fname = __func__](auto ec) { if (ec) { JLOG(journal_.error()) - << __func__ << " async_close : " + << fname << " async_close : " << "error code = " << ec << " - " << toString(); } closing_ = false; diff --git a/src/ripple/app/reporting/ReportingETL.cpp b/src/ripple/app/reporting/ReportingETL.cpp index 4a8c4cf1de..f7d38ba132 100644 --- a/src/ripple/app/reporting/ReportingETL.cpp +++ b/src/ripple/app/reporting/ReportingETL.cpp @@ -333,11 +333,11 @@ ReportingETL::publishLedger(uint32_t ledgerSequence, uint32_t maxAttempts) continue; } - publishStrand_.post([this, ledger]() { + publishStrand_.post([this, ledger, fname = __func__]() { app_.getOPs().pubLedger(ledger); setLastPublish(); JLOG(journal_.info()) - << __func__ << " : " + << fname << " : " << "Published ledger. " << detail::toString(ledger->info()); }); return true; diff --git a/src/ripple/nodestore/impl/Database.cpp b/src/ripple/nodestore/impl/Database.cpp index eea66c2614..de56c768c8 100644 --- a/src/ripple/nodestore/impl/Database.cpp +++ b/src/ripple/nodestore/impl/Database.cpp @@ -120,14 +120,14 @@ Database::importInternal(Backend& dstBackend, Database& srcDB) { Batch batch; batch.reserve(batchWritePreallocationSize); - auto storeBatch = [&]() { + auto storeBatch = [&, fname = __func__]() { try { dstBackend.storeBatch(batch); } catch (std::exception const& e) { - JLOG(j_.error()) << "Exception caught in function " << __func__ + JLOG(j_.error()) << "Exception caught in function " << fname << ". Error: " << e.what(); return; } @@ -201,7 +201,7 @@ Database::storeLedger( Batch batch; batch.reserve(batchWritePreallocationSize); - auto storeBatch = [&]() { + auto storeBatch = [&, fname = __func__]() { std::uint64_t sz{0}; for (auto const& nodeObject : batch) sz += nodeObject->getData().size(); @@ -213,7 +213,7 @@ Database::storeLedger( catch (std::exception const& e) { fail( - std::string("Exception caught in function ") + __func__ + + std::string("Exception caught in function ") + fname + ". Error: " + e.what()); return false; } diff --git a/src/ripple/nodestore/impl/DatabaseShardImp.cpp b/src/ripple/nodestore/impl/DatabaseShardImp.cpp index 14c2448d3f..daecdb42bd 100644 --- a/src/ripple/nodestore/impl/DatabaseShardImp.cpp +++ b/src/ripple/nodestore/impl/DatabaseShardImp.cpp @@ -500,7 +500,7 @@ DatabaseShardImp::importShard( } dstDir /= std::to_string(shardIndex); - auto renameDir = [&](path const& src, path const& dst) { + auto renameDir = [&, fname = __func__](path const& src, path const& dst) { try { rename(src, dst); @@ -508,7 +508,7 @@ DatabaseShardImp::importShard( catch (std::exception const& e) { return fail( - std::string(". Exception caught in function ") + __func__ + + std::string(". Exception caught in function ") + fname + ". Error: " + e.what(), std::lock_guard(mutex_)); }