mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 11:12:50 +01:00
Merge bitcoin/bitcoin#29419: log: deduplicate category names and improve logging.cpp
b0344c219alogging: remove unused BCLog::UTIL (Vasil Dimov)d3b3af9034log: deduplicate category names and improve logging.cpp (Vasil Dimov) Pull request description: The code in `logging.cpp` needs to: * Get the category name given the flag (e.g. `BCLog::PRUNE` -> `"prune"`) * Get the flag given the category name (e.g. `"prune"` -> `BCLog::PRUNE`) * Get the list of category names sorted in alphabetical order Achieve this by using the proper std containers. The result is * less code (the diff of the first commit is +62 / -129) * faster code (to linear search and no copy+sort) * more maintainable code (the categories are no longer duplicated in `LogCategories[]` and `LogCategoryToStr()`) This behavior is preserved: `BCLog::NONE` -> `""` (lookup by `LogCategoryToStr()`) `""` -> `BCLog::ALL` (lookup by `GetLogCategory("")`) --- Also remove unused `BCLog::UTIL`. --- These changes (modulo the `BCLog::UTIL` removal) are part of https://github.com/bitcoin/bitcoin/pull/29415 but they make sense on their own and would be good to have them, regardless of the fate of https://github.com/bitcoin/bitcoin/pull/29415. Also, if this is merged, that would reduce the size of https://github.com/bitcoin/bitcoin/pull/29415, thus the current standalone PR. ACKs for top commit: davidgumberg: crACKb0344c219apinheadmz: ACKb0344c219aryanofsky: Code review ACKb0344c219a. Nice cleanup! Having to maintain multiple copies of the same mapping seemed messy and a like a possible footgun. I checked old and new mappings in both directions and confirmed no behavior should be changing. Tree-SHA512: 57f87a090932f9b33dc8e075d1855dba9b71a3243a0758511745483dec2d9c46d3b532eadab297e78164c9b7caba370986ee380696a45f0778a841082f8e21a7
This commit is contained in:
@@ -65,11 +65,10 @@ namespace BCLog {
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
LOCK = (1 << 24),
|
||||
#endif
|
||||
UTIL = (1 << 25),
|
||||
BLOCKSTORAGE = (1 << 26),
|
||||
TXRECONCILIATION = (1 << 27),
|
||||
SCAN = (1 << 28),
|
||||
TXPACKAGES = (1 << 29),
|
||||
BLOCKSTORAGE = (1 << 25),
|
||||
TXRECONCILIATION = (1 << 26),
|
||||
SCAN = (1 << 27),
|
||||
TXPACKAGES = (1 << 28),
|
||||
ALL = ~(uint32_t)0,
|
||||
};
|
||||
enum class Level {
|
||||
|
||||
Reference in New Issue
Block a user