This PR is a draft because it is based on #34374. All new changes are in last commit.
Problem: Every logging connection receives all kernel log output, regardless of which context produced it. An application that opens two chainstates (say mainnet and signet, or a test creating several contexts) gets one interleaved log stream and can't tell which context a line came from. #30342 can separate them, but only if the application says which logging connection belongs to which context, and the current API has no way to do that: connections aren't passed to any other kernel function, and the only log setting, btck_logging_set_min_level, is process-wide.
Solution: Add btck_context_options_set_logger, and make btck_logging_set_min_level apply to a single connection:
btck_LoggingConnection* log = btck_logging_connection_create(callback, user_data, destroy_user_data);
btck_logging_set_min_level(log, btck_LogLevel_DEBUG);
btck_context_options_set_logger(options, log);
btck_Context* context = btck_context_create(options);
A connection receives nothing until a context uses it. Per-connection levels are a small feature, but the main purpose is to change the API now, before more code depends on it: #30342 builds on this to give each context's connection only that context's entries, so code like the above gets separate output per context unchanged. Until then, a connection may also receive entries from other kernel operations, as the header documents. Small change to bitcoinkernel.{h,cpp}, the C++ wrapper, bitcoin-chainstate and test_kernel, based on #34374 (only the last commit is new).
Alternatives: Keep the current API and change it when #30342 is ready, since the kernel API has no compatibility guarantees. But that change would be expensive for callers: code written today sets up logging once, often far from where contexts are created (in main, a logging module, or when a language binding is imported), because nothing needs the connection afterwards. Per-context output would then mean restructuring every application and binding to get a connection to each place that creates a context. With a connection in the API from the start it costs one extra call, and bindings can map connections to their language's usual per-object loggers (e.g. Python's logging.getLogger(name)). #34775 takes the opposite approach, replacing connections with a single global callback.