diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2023-12-14 12:23:36 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2024-02-11 15:14:12 +0100 |
commit | d3b3af90343b7671231afd7dff87e87ff86d31d7 (patch) | |
tree | 389aafdd51f646a5b554e2cf8bb957822456451e /src/wallet | |
parent | 7143d4388407ab3d12005e55a02d5e8f334e4dc9 (diff) |
log: deduplicate category names and improve logging.cpp
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 (this diff 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("")`)
Diffstat (limited to 'src/wallet')
0 files changed, 0 insertions, 0 deletions