mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
logging, refactor: minor encapsulation improvement and use BCLog::NONE instead of 0
* Make the standalone function `LogCategoryToStr()` private inside `logging.cpp` (aka `static`) - it is only used in that file. * Make the method `Logger::GetLogPrefix()` `private` - it is only used within the class. * Use `BCLog::NONE` to initialize `m_categories` instead of `0`. We later check whether it is `BCLog::NONE` (in `Logger::DefaultShrinkDebugFile()`).
This commit is contained in:
parent
160706aa38
commit
8c6f3bf163
2 changed files with 4 additions and 4 deletions
|
@ -248,7 +248,7 @@ std::string BCLog::Logger::LogLevelToStr(BCLog::Level level)
|
|||
assert(false);
|
||||
}
|
||||
|
||||
std::string LogCategoryToStr(BCLog::LogFlags category)
|
||||
static std::string LogCategoryToStr(BCLog::LogFlags category)
|
||||
{
|
||||
if (category == BCLog::ALL) {
|
||||
return "all";
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace BCLog {
|
|||
std::atomic<Level> m_log_level{DEFAULT_LOG_LEVEL};
|
||||
|
||||
/** Log categories bitfield. */
|
||||
std::atomic<uint32_t> m_categories{0};
|
||||
std::atomic<uint32_t> m_categories{BCLog::NONE};
|
||||
|
||||
void FormatLogStrInPlace(std::string& str, LogFlags category, Level level, std::string_view source_file, int source_line, std::string_view logging_function, std::string_view threadname, SystemClock::time_point now, std::chrono::seconds mocktime) const;
|
||||
|
||||
|
@ -132,6 +132,8 @@ namespace BCLog {
|
|||
void LogPrintStr_(std::string_view str, std::string_view logging_function, std::string_view source_file, int source_line, BCLog::LogFlags category, BCLog::Level level)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(m_cs);
|
||||
|
||||
std::string GetLogPrefix(LogFlags category, Level level) const;
|
||||
|
||||
public:
|
||||
bool m_print_to_console = false;
|
||||
bool m_print_to_file = false;
|
||||
|
@ -145,8 +147,6 @@ namespace BCLog {
|
|||
fs::path m_file_path;
|
||||
std::atomic<bool> m_reopen_file{false};
|
||||
|
||||
std::string GetLogPrefix(LogFlags category, Level level) const;
|
||||
|
||||
/** Send a string to the log output */
|
||||
void LogPrintStr(std::string_view str, std::string_view logging_function, std::string_view source_file, int source_line, BCLog::LogFlags category, BCLog::Level level)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_cs);
|
||||
|
|
Loading…
Add table
Reference in a new issue