mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
logging: add -loglevelalways=1 option
This option tells the logging system to always include a "[cat:level]" prefix, so [net] becomes [net:debug], LogInfo/LogPrint statements will have an [all:info] prefix, and LogWarning and LogError logs will become [all:warning] and [all:error]. This may be easier for automated parsing of logs, particularly if additional prefixes such as thread or source location are enabled.
This commit is contained in:
@@ -392,7 +392,7 @@ std::string BCLog::Logger::GetLogPrefix(BCLog::LogFlags category, BCLog::Level l
|
||||
{
|
||||
if (category == LogFlags::NONE) category = LogFlags::ALL;
|
||||
|
||||
const bool has_category{category != LogFlags::ALL};
|
||||
const bool has_category{m_always_print_category_level || category != LogFlags::ALL};
|
||||
|
||||
// If there is no category, Info is implied
|
||||
if (!has_category && level == Level::Info) return {};
|
||||
@@ -402,7 +402,7 @@ std::string BCLog::Logger::GetLogPrefix(BCLog::LogFlags category, BCLog::Level l
|
||||
s += LogCategoryToStr(category);
|
||||
}
|
||||
|
||||
if (!has_category || level != Level::Debug) {
|
||||
if (m_always_print_category_level || !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
|
||||
|
||||
Reference in New Issue
Block a user