Do not use __func__ inside lambdas

This commit is contained in:
seelabs
2021-06-01 15:07:39 -04:00
committed by manojsdoshi
parent 04ff6249d5
commit 9fd5cd303d
4 changed files with 12 additions and 12 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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_));
}