move-onlyish: Move logging levels to util/log.h
This is not strictly move-only because BCLog::Level is now defined as a type alias for util::log::Level; Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
1 parent
56d113cab0
commit
94c0adf4e8
2 files changed
+14
-7
No files matched your search
@@ -63,13 +63,6 @@ struct LogCategory {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace BCLog {
|
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 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 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
|
constexpr uint64_t RATELIMIT_MAX_BYTES{1024 * 1024}; // maximum number of bytes per source location that can be logged within the RATELIMIT_WINDOW
|
||||||
|
|||||||
@@ -29,4 +29,18 @@ private:
|
|||||||
std::source_location m_loc;
|
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
|
#endif // BITCOIN_UTIL_LOG_H
|
||||||
Reference in new issue
Block a user