Merge bitcoin/bitcoin#26619: log: expand BCLog::LogFlags (categories) to 64 bits

b31a0cd037 log: expand BCLog::LogFlags (categories) to 64 bits (Larry Ruane)

Pull request description:

  Increase the maximum number of logging categories from 32 to 64.

  We're currently using 29 of the 32 available logging categories (there are only 3 remaining). It would be good to increase the limit soon; the fourth PR to be merged that adds a new logging category will be blocked until something like this is done.

  This PR also adds a `TEST` category that uses the new range (`1ULL << 63`) in case there's a hidden assumption somewhere that the `BCLog::LogFlags` type is 32 bits. (Also added a test for this test category.) It also provides an example showing that the expression must be `1ULL << <shift>` for shift value 31 and beyond.

ACKs for top commit:
  achow101:
    ACK b31a0cd037
  vasild:
    ACK b31a0cd037
  ryanofsky:
    Code review ACK b31a0cd037, just dropping mask_bit constant since last review. I still think
  theStack:
    Code-review ACK b31a0cd037

Tree-SHA512: de422dbeb479848d370aed42d415f42461457ab0eda62b245dc7ff9f0e111626e7d4c0d62ff13082ec664d05fbb0db04c71eb4b6f22eb8f19198826a67c4035e
This commit is contained in:
Ava Chow
2024-09-03 16:33:49 -04:00
4 changed files with 41 additions and 39 deletions

View File

@@ -7,6 +7,7 @@
#include <common/settings.h>
#include <consensus/amount.h> // For CAmount
#include <logging.h> // For BCLog::CategoryMask
#include <net.h> // For NodeId
#include <net_types.h> // For banmap_t
#include <netaddress.h> // For Network
@@ -84,7 +85,7 @@ public:
virtual int getExitStatus() = 0;
// Get log flags.
virtual uint32_t getLogCategories() = 0;
virtual BCLog::CategoryMask getLogCategories() = 0;
//! Initialize app dependencies.
virtual bool baseInitialize() = 0;