diff options
author | Anthony Towns <aj@erisian.com.au> | 2023-08-22 14:38:38 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2023-12-15 11:03:25 +1000 |
commit | 667ce3e3297645527b07314e1d5a82275fb25845 (patch) | |
tree | 7b0743bb1106fb7b9982ae57aa7bad8b8f59b47a /src/logging.cpp | |
parent | ab34dc6012351e7b8aab871dd9d2b38ade1cd9bc (diff) | |
download | bitcoin-667ce3e3297645527b07314e1d5a82275fb25845.tar.xz |
logging: Drop BCLog::Level::None
Now that Info-level logging is always logged, there is no further
need for the "None" level, so remove it.
Diffstat (limited to 'src/logging.cpp')
-rw-r--r-- | src/logging.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index d516cd65a5..f6cd404971 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -215,8 +215,6 @@ std::string BCLog::Logger::LogLevelToStr(BCLog::Level level) return "warning"; case BCLog::Level::Error: return "error"; - case BCLog::Level::None: - return ""; } assert(false); } @@ -307,8 +305,6 @@ static std::optional<BCLog::Level> GetLogLevel(const std::string& level_str) return BCLog::Level::Warning; } else if (level_str == "error") { return BCLog::Level::Error; - } else if (level_str == "none") { - return BCLog::Level::None; } else { return std::nullopt; } @@ -396,20 +392,17 @@ std::string BCLog::Logger::GetLogPrefix(BCLog::LogFlags category, BCLog::Level l { const bool has_category{category != LogFlags::NONE}; - if (!has_category && level == Level::None) return {}; - // If there is no category, Info is implied if (!has_category && level == Level::Info) return {}; std::string s{"["}; if (has_category) { s += LogCategoryToStr(category); - - // If there is a category, Debug is implied - if (level == Level::Debug) level = Level::None; } - if (level != Level::None) { + if (!has_category || level != Level::Debug) { + // If there is a category, Debug is implied, so don't add the level + // Only add separator if we have a category if (has_category) s += ":"; s += Logger::LogLevelToStr(level); |