mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-10 15:47:17 +02:00
scripted-diff: logging: Switch from StdLockGuard to STDLOCK
-BEGIN VERIFY SCRIPT- sed -i 's/StdLockGuard scoped_lock(\(.*\));/STDLOCK(\1);/' src/logging.h src/logging.cpp -END VERIFY SCRIPT-
This commit is contained in:
@@ -53,7 +53,7 @@ static int FileWriteStr(std::string_view str, FILE *fp)
|
||||
|
||||
bool BCLog::Logger::StartLogging()
|
||||
{
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
|
||||
assert(m_buffering);
|
||||
assert(m_fileout == nullptr);
|
||||
@@ -97,7 +97,7 @@ bool BCLog::Logger::StartLogging()
|
||||
|
||||
void BCLog::Logger::DisconnectTestLogger()
|
||||
{
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
m_buffering = true;
|
||||
if (m_fileout != nullptr) fclose(m_fileout);
|
||||
m_fileout = nullptr;
|
||||
@@ -111,7 +111,7 @@ void BCLog::Logger::DisconnectTestLogger()
|
||||
void BCLog::Logger::DisableLogging()
|
||||
{
|
||||
{
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
assert(m_buffering);
|
||||
assert(m_print_callbacks.empty());
|
||||
}
|
||||
@@ -159,7 +159,7 @@ bool BCLog::Logger::WillLogCategoryLevel(BCLog::LogFlags category, BCLog::Level
|
||||
|
||||
if (!WillLogCategory(category)) return false;
|
||||
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
const auto it{m_category_log_levels.find(category)};
|
||||
return level >= (it == m_category_log_levels.end() ? LogLevel() : it->second);
|
||||
}
|
||||
@@ -392,7 +392,7 @@ BCLog::LogRateLimiter::Status BCLog::LogRateLimiter::Consume(
|
||||
const SourceLocation& source_loc,
|
||||
const std::string& str)
|
||||
{
|
||||
StdLockGuard scoped_lock(m_mutex);
|
||||
STDLOCK(m_mutex);
|
||||
auto& stats{m_source_locations.try_emplace(source_loc, m_max_bytes).first->second};
|
||||
Status status{stats.m_dropped_bytes > 0 ? Status::STILL_SUPPRESSED : Status::UNSUPPRESSED};
|
||||
|
||||
@@ -423,7 +423,7 @@ void BCLog::Logger::FormatLogStrInPlace(std::string& str, BCLog::LogFlags catego
|
||||
|
||||
void BCLog::Logger::LogPrintStr(std::string_view str, SourceLocation&& source_loc, BCLog::LogFlags category, BCLog::Level level, bool should_ratelimit)
|
||||
{
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
return LogPrintStr_(str, std::move(source_loc), category, level, should_ratelimit);
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ void BCLog::LogRateLimiter::Reset()
|
||||
{
|
||||
decltype(m_source_locations) source_locations;
|
||||
{
|
||||
StdLockGuard scoped_lock(m_mutex);
|
||||
STDLOCK(m_mutex);
|
||||
source_locations.swap(m_source_locations);
|
||||
m_suppression_active = false;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ bool BCLog::Logger::SetCategoryLogLevel(std::string_view category_str, std::stri
|
||||
const auto level = GetLogLevel(level_str);
|
||||
if (!level.has_value() || level.value() > MAX_USER_SETABLE_SEVERITY_LEVEL) return false;
|
||||
|
||||
StdLockGuard scoped_lock(m_cs);
|
||||
STDLOCK(m_cs);
|
||||
m_category_log_levels[flag] = level.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user