Skip to content

log: add structured fields to log entries#35376

Closed
0xjc65eth wants to merge 1 commit into
bitcoin:masterfrom
0xjc65eth:structured-log-entry-fields
Closed

log: add structured fields to log entries#35376
0xjc65eth wants to merge 1 commit into
bitcoin:masterfrom
0xjc65eth:structured-log-entry-fields

Conversation

@0xjc65eth
Copy link
Copy Markdown

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.

@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented May 25, 2026

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

Code Coverage & Benchmarks

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

Reviews

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

@sedited
Copy link
Copy Markdown
Contributor

sedited commented May 25, 2026

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.

@sedited sedited closed this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants