log: add structured fields to log entries #35376

pull 0xjc65eth wants to merge 1 commits into bitcoin:master from 0xjc65eth:structured-log-entry-fields changing 3 files +30 −4
  1. 0xjc65eth commented at 9:27 PM on May 25, 2026: none

    Change Description

    This is a deliberately small first step for structured logging: add an optional fields vector to util::log::Entry and a small util::log::KV() helper for producers.

    The existing text output is intentionally unchanged in this PR. The change gives future JSON/ZMQ/database log consumers a place to read structured per-message data without forcing a decision about the final wire format in the first patch.

    Concretely this PR:

    • adds util::log::KeyValue and util::log::KV();
    • stores std::vector<KeyValue> fields on util::log::Entry;
    • accounts for field memory usage while entries are buffered before logging starts;
    • extends a logging unit test to pass fields and confirm legacy formatted output remains unchanged.

    This addresses the consumer-side foundation discussed in #35369.

    Testing

    • git diff --check
    • Attempted CMake configure with cmake -B build -S . -DBUILD_GUI=OFF -DBUILD_BENCH=OFF -DBUILD_FUZZ_BINARY=OFF -DWITH_ZMQ=OFF -DWITH_USDT=OFF -DWITH_MULTIPROCESS=OFF; configure stopped because Boost >= 1.74 is not installed in this local environment.

    The message stays human; the fields wait beneath it.

  2. log: add structured fields to entries d82ae388f9
  3. DrahtBot added the label Utils/log/libs on May 25, 2026
  4. DrahtBot commented at 9:27 PM on May 25, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35376.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. sedited commented at 9:43 PM on May 25, 2026: contributor

    NACK

    We don't accept PRs where it is not clear that the author understands the changes. Since the PR description even includes the error output from an LLM that is doubtful. Closing.

  6. sedited closed this on May 25, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-31 17:50 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me