Review report

core: PR #35322

Design and approach

Align the kernel logging contract with level-setting behavior (src/kernel/bitcoinkernel.cpp:840, head)

This call now enables a category at the requested level. The public kernel header promises that btck_logging_set_level_category does not enable the selected category and requires a separate enable call. A caller that sets a threshold in preparation for enabling a category later will therefore start receiving its messages immediately. If this breaking semantic change is intended for the experimental, unversioned API, update the header contract. If callers must retain threshold-only configuration, the representation needs to preserve that distinction.

Limit the logging visibility override (src/kernel/CMakeLists.txt:127, head)

This sets default visibility for the entire logging.cpp translation unit. In a shared build with REDUCE_EXPORTS, it overrides the project's hidden-visibility setting for all externally linked logger definitions in that unit, although test_kernel needs only a small number of internal symbols. Prefer a narrowly scoped test export or a test that exercises the exported kernel API, so the assertions remain available without exposing unrelated logger implementation symbols from the shared library.

🟡 Minor

Resolve global and category log levels independently (src/init/common.cpp:72, head)

Each global -loglevel is applied directly to the categories currently in the Debug mask. A later category-specific option targets that same mutable mask, so an earlier info setting may already have removed the category, and a later global setting may overwrite an earlier category-specific threshold. For example, -debug=net -loglevel=info -loglevel=net:trace leaves net disabled, although category-specific levels are documented to override the global level. Preserve the categories selected by -debug while resolving startup levels, then apply the global threshold and category-specific overrides independently of option order.

Serialize updates to the per-level masks (src/logging.cpp:132, head)

Concurrent category-level updates can leave the masks in a state that represents no valid threshold. For example, an Info update can clear the Trace bit, a concurrent Trace update can set both Trace and Debug, and the Info update can then clear Debug. The category will log Trace messages but not Debug messages, and remain in that state after both calls return. Kernel logging APIs can make these updates without a common lock. Serialize the mask updates or use a representation that changes a category's threshold atomically.

Export logger test symbols for MSVC shared builds (src/kernel/CMakeLists.txt:126, head)

With BUILD_SHARED_LIBS enabled under MSVC, this branch is skipped and the preceding MinGW-only export branch does not apply. The changed test_kernel calls LogInstance() and Logger::WillLogCategoryLevel() through the bitcoinkernel DLL, but neither symbol is part of the exported kernel C API. Those unresolved symbols prevent test_kernel from linking in this configuration. Export the symbols needed by the test for MSVC or avoid linking the test to these internal logger symbols.

Review coverage was incomplete. The adversarial review had incomplete evidence. The adversarial_glm review did not complete.