move-onlyish: Move logging levels to util/log.h
What changed, and why it matters
This commit is a simple code reorganization: it moves the definition of logging levels (Trace, Debug, Info, Warning, Error) from one header file to another and creates a compatibility alias so existing code keeps working. There is no functional change and no security impact.
No security action needed. Treat as normal code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change removes the BCLog::Level enum class from src/logging.h and adds an equivalent util::log::Level enum class in src/util/log.h. BCLog::Level is then defined as a type alias (using Level = util::log::Level) for backward compatibility. The numeric values and semantics of the log levels are unchanged. This is a pure refactoring/cleanup patch.
Changed components
src/logging.hsrc/util/log.hInspect captured patch +14 / −7
diff --git a/src/logging.h b/src/logging.h
index 18eb2c61..f9fddd5e 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -63,13 +63,6 @@ struct LogCategory {
};
namespace BCLog {
- enum class Level {
- Trace = 0, // High-volume or detailed logging for development/debugging
- Debug, // Reasonably noisy logging, but still usable in production
- Info, // Default
- Warning,
- Error,
- };
constexpr auto DEFAULT_LOG_LEVEL{Level::Debug};
constexpr size_t DEFAULT_MAX_LOG_BUFFER{1'000'000}; // buffer up to 1MB of log data prior to StartLogging
constexpr uint64_t RATELIMIT_MAX_BYTES{1024 * 1024}; // maximum number of bytes per source location that can be logged within the RATELIMIT_WINDOW
diff --git a/src/util/log.h b/src/util/log.h
index 7ad54863..f1d3bb26 100644
--- a/src/util/log.h
+++ b/src/util/log.h
@@ -29,4 +29,18 @@ private:
std::source_location m_loc;
};
+namespace util::log {
+enum class Level {
+ Trace = 0, // High-volume or detailed logging for development/debugging
+ Debug, // Reasonably noisy logging, but still usable in production
+ Info, // Default
+ Warning,
+ Error,
+};
+} // namespace util::log
+
+namespace BCLog {
+//! Alias for compatibility. Prefer util::log::Level over BCLog::Level in new code.
+using Level = util::log::Level;
+} // namespace BCLog
#endif // BITCOIN_UTIL_LOG_H
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.