kernel, logging: Pass Logger instances to kernel objects #30342

pull ryanofsky wants to merge 14 commits into bitcoin:master from ryanofsky:pr/gklog changing 57 files +801 −431
  1. ryanofsky commented at 5:52 pm on June 26, 2024: contributor

    Pass Logger instances to BlockManager, CCoinsViewDB, CDBWrapper, Chainstate, ChainstateManager, CoinsViews, and CTxMemPool classes so libbitcoinkernel applications and tests have the option to control where log output goes instead of having all output sent to the global logger.

    This PR is an alternative to #30338. It is more limited because it only changes kernel code while leaving other parts of the codebase alone. It also takes the opportunity to migrate legacy LogPrint / LogPrintf calls to the new log macros introduced in #28318.


    This is based on #29256 + #33847. The non-base commits are:

  2. DrahtBot commented at 5:52 pm on June 26, 2024: contributor

    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/30342.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34514 (refactor: remove unnecessary std::move for trivially copyable types by l0rinc)
    • #34465 (refactor: separate log generation from log handling by ryanofsky)
    • #34436 (refactor + log: use new CeilDiv helper in UTXO Flushing warning by l0rinc)
    • #34435 (refactor: use _MiB/_GiB consistently for byte conversions by l0rinc)
    • #34411 ([POC] Full Libevent removal by fanquake)
    • #34342 (cli: Replace libevent usage with simple http client by fjahr)
    • #34320 (coins: remove redundant and confusing CCoinsViewDB::HaveCoin by l0rinc)
    • #34254 (validation: Prevent duplicate logging and looping in invalid block handling by mzumsande)
    • #34165 (coins: don’t mutate main cache when connecting block by andrewtoth)
    • #34124 (refactor: make CCoinsView a pure virtual interface by l0rinc)
    • #34038 (logging: API improvements by ajtowns)
    • #33847 (kernel: Improve logging API by ryanofsky)
    • #33646 (log: check fclose() results and report safely in logging.cpp by cedwies)
    • #33512 (coins: use number of dirty cache entries in flush warnings/logs by l0rinc)
    • #33324 (blocks: add -reobfuscate-blocks argument to enable (de)obfuscating existing blocks by l0rinc)
    • #33306 (index: Force database compaction in coinstatsindex by fjahr)
    • #32317 (kernel: Separate UTXO set access from validation functions by sedited)
    • #32297 (bitcoin-cli: Add -ipcconnect option by ryanofsky)
    • #31723 (qa: Facilitate debugging bitcoind inside functional tests by hodlinator)
    • #31644 (leveldb: show non-default options during init by l0rinc)
    • #31382 (kernel: Flush in ChainstateManager destructor by sedited)
    • #31132 (validation: fetch block inputs on parallel threads 3x faster IBD by andrewtoth)
    • #29256 (log, refactor: Allow log macros to accept context arguments by ryanofsky)
    • #26022 (Add util::ResultPtr class by ryanofsky)
    • #25665 (refactor: Add util::Result failure types and ability to merge result values by ryanofsky)
    • #24230 (indexes: Stop using node internal types and locking cs_main, improve sync logic by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • logger instances is leaked -> logger instance is leaked [subject-verb agreement: plural “instances” with singular verb “is” is incorrect; use singular “instance is” (or “instances are”)]

    2026-02-09 18:16:25

  3. sedited commented at 8:21 pm on June 26, 2024: contributor
    Concept ACK.
  4. ryanofsky force-pushed on Jun 26, 2024
  5. DrahtBot added the label CI failed on Jun 26, 2024
  6. DrahtBot commented at 10:35 pm on June 26, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    Leave a comment here, if you need help tracking down a confusing failure.

    Debug: https://github.com/bitcoin/bitcoin/runs/26722091796

  7. ryanofsky commented at 10:36 pm on June 26, 2024: contributor
    Updated 45423355735770f01d2bac738cc8b0b41415e921 -> db1b9f7696af80036de739408cd9eae5d06481ec (pr/gklog.1 -> pr/gklog.2, compare) moving code to an earlier commit to fix a “test-each-commit” test failure https://github.com/bitcoin/bitcoin/actions/runs/9684398780/job/26722073921?pr=30342, and cleaning up code to fix a clang-tidy warning https://cirrus-ci.com/task/5893151045451776
  8. DrahtBot removed the label CI failed on Jun 27, 2024
  9. DrahtBot added the label Needs rebase on Jul 2, 2024
  10. ryanofsky referenced this in commit ecadc8f6e5 on Jul 3, 2024
  11. ryanofsky force-pushed on Jul 9, 2024
  12. ryanofsky commented at 10:23 pm on July 9, 2024: contributor

    Rebased db1b9f7696af80036de739408cd9eae5d06481ec -> 42d0e06d1a4343c2bf3257f26cf18b79072c6b0d (pr/gklog.2 -> pr/gklog.3, compare) to fix conflict with #30141. Also added a commit to let kernel applications direct low-level util output to custom log instances. Updated 42d0e06d1a4343c2bf3257f26cf18b79072c6b0d -> fcaed3faf0f12b3b322e65df1e81d455bbee7db5 (pr/gklog.3 -> pr/gklog.4, compare) to fix CI errors Updated fcaed3faf0f12b3b322e65df1e81d455bbee7db5 -> f005677f762754ae09417c2a418e27d28ef3c7e1 (pr/gklog.4 -> pr/gklog.5, compare) to fix more CI errors Rebased f005677f762754ae09417c2a418e27d28ef3c7e1 -> dcd055ecf9c20b84930c2ce45d922427cf0112ea (pr/gklog.5 -> pr/gklog.6, compare) due to conflicts with #30425 and #30407 Rebased dcd055ecf9c20b84930c2ce45d922427cf0112ea -> 53d7933727ebe0670dceb88ec9f1020bd7b0b280 (pr/gklog.6 -> pr/gklog.7, compare) due to conflict with #28052 Rebased 53d7933727ebe0670dceb88ec9f1020bd7b0b280 -> 10c275342dca365a6678da5fc016ca9d46d9dfca (pr/gklog.7 -> pr/gklog.8, compare) due to conflict with #30485 Rebased 10c275342dca365a6678da5fc016ca9d46d9dfca -> 493dd26b75d0e35422b3230be3c72a0f96eb5e8a (pr/gklog.8 -> pr/gklog.9, compare) due to various conflicts Rebased 493dd26b75d0e35422b3230be3c72a0f96eb5e8a -> e971028fa5e570acf585073494acd65f4831ab1c (pr/gklog.9 -> pr/gklog.10, compare) due to conflicts with #31393, #31490, #30965

    Rebased e971028fa5e570acf585073494acd65f4831ab1c -> 282db88a9b1789f0d78928c87c7204402ac11ac3 (pr/gklog.10 -> pr/gklog.11, compare)

    Rebased 282db88a9b1789f0d78928c87c7204402ac11ac3 -> ec6d771d3b34ec979e373f025c4f064ae44df860 (pr/gklog.11 -> pr/gklog.12, compare)

    Rebased ec6d771d3b34ec979e373f025c4f064ae44df860 -> b1b72969c9764636721a7518a2f4453d0eb3845d (pr/gklog.12 -> pr/gklog.13, compare)

    Rebased b1b72969c9764636721a7518a2f4453d0eb3845d -> d0e2944bb18e44c599312b980900c324ae698464 (pr/gklog.13 -> pr/gklog.14, compare) on updated base PR to fix CI errors (https://github.com/bitcoin/bitcoin/actions/runs/18514131135?pr=30342)

    Rebased d0e2944bb18e44c599312b980900c324ae698464 -> 8482a49ab89012c3cd99acd43e1f698311426c3a (pr/gklog.14 -> pr/gklog.15, compare)

    Rebased 8482a49ab89012c3cd99acd43e1f698311426c3a -> baaaa41b93cba064d12d641899968ee897eb0671 (pr/gklog.15 -> pr/gklog.16, compare) to fix fuzz test errors https://github.com/bitcoin/bitcoin/actions/runs/19249628369/job/55031630303?pr=30342, also making updates to bitcoinkernel.h documentation

    Rebased baaaa41b93cba064d12d641899968ee897eb0671 -> b9dc75a2b5d6bfadce65cd2837a3042c888a8afd (pr/gklog.16 -> pr/gklog.17, compare)

    Rebased b9dc75a2b5d6bfadce65cd2837a3042c888a8afd -> 97be3ef0b6239a9e674be3d8c70f99ec5fe5b8eb (pr/gklog.17 -> pr/gklog.18, compare)

    Rebased 97be3ef0b6239a9e674be3d8c70f99ec5fe5b8eb -> db29e8fb43fa8011eb5c68f376ea74b4f087deda (pr/gklog.18 -> pr/gklog.19, compare) on top of #29256 pr/bclog.34 and #33847 pr/klog.4

    Updated db29e8fb43fa8011eb5c68f376ea74b4f087deda -> d6c23d4219b30dc8e045f4c6b90a7ad493faf383 (pr/gklog.19 -> pr/gklog.20, compare) to fix kernel test MSAN error https://github.com/bitcoin/bitcoin/actions/runs/21115418786/job/60720235987?pr=30342

    Rebased d6c23d4219b30dc8e045f4c6b90a7ad493faf383 -> 75e1e958f5e8a27491723aa88c69bf3cd8de7509 (pr/gklog.20 -> pr/gklog.21, compare) on top of #29256 pr/bclog.34 and #33847 pr/klog.5

    Rebased 75e1e958f5e8a27491723aa88c69bf3cd8de7509 -> cc0cfe20c8ac56ffe3a47d9ee3f109fdf0c09c36 (pr/gklog.21 -> pr/gklog.22, compare) due to conflicts with #34253 and #33680

    Updated cc0cfe20c8ac56ffe3a47d9ee3f109fdf0c09c36 -> c2e3362b0050483e5a95c9aaccb9d3afe6328c1e (pr/gklog.22 -> pr/gklog.23, compare) to fix CI errors https://github.com/bitcoin/bitcoin/actions/runs/21643951237

    Updated c2e3362b0050483e5a95c9aaccb9d3afe6328c1e -> 7b78335f66b08d039f20dc31fb326883ab5ad3c8 (pr/gklog.23 -> pr/gklog.24, compare) to fix CI errors https://github.com/bitcoin/bitcoin/actions/runs/21645374775

    Rebased 7b78335f66b08d039f20dc31fb326883ab5ad3c8 -> aa4d26979f0b1c24adeeec489b36180c87ca484c (pr/gklog.24 -> pr/gklog.25, compare) on top of #29256 pr/bclog.36 and #33847 pr/klog.5

    Updated aa4d26979f0b1c24adeeec489b36180c87ca484c -> 5126eaf1e369f1579d2307125aa8383786f9b3f8 (pr/gklog.25 -> pr/gklog.26, compare) to fix IWYU and each-commit errors https://github.com/bitcoin/bitcoin/actions/runs/21830259022/job/62995439943?pr=30342

    Updated 5126eaf1e369f1579d2307125aa8383786f9b3f8 -> eeb84002a84226614e5d3acb9013c15ba5ce71ff (pr/gklog.26 -> pr/gklog.27, compare) to fix IWYU errors https://github.com/bitcoin/bitcoin/actions/runs/21833389551/job/62998114427?pr=30342

  13. DrahtBot removed the label Needs rebase on Jul 10, 2024
  14. ryanofsky force-pushed on Jul 10, 2024
  15. ryanofsky force-pushed on Jul 10, 2024
  16. DrahtBot added the label CI failed on Jul 10, 2024
  17. DrahtBot commented at 6:22 pm on July 10, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    Leave a comment here, if you need help tracking down a confusing failure.

    Debug: https://github.com/bitcoin/bitcoin/runs/27284943547

  18. DrahtBot removed the label CI failed on Jul 10, 2024
  19. DrahtBot added the label Needs rebase on Jul 16, 2024
  20. ryanofsky force-pushed on Jul 18, 2024
  21. DrahtBot removed the label Needs rebase on Jul 18, 2024
  22. DrahtBot added the label CI failed on Jul 22, 2024
  23. DrahtBot commented at 11:07 am on July 22, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/27590643116

    Make sure to run all tests locally, according to the documentation.

    The failure may happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  24. DrahtBot removed the label CI failed on Jul 22, 2024
  25. DrahtBot added the label Needs rebase on Jul 26, 2024
  26. ryanofsky force-pushed on Aug 7, 2024
  27. ryanofsky force-pushed on Aug 7, 2024
  28. DrahtBot removed the label Needs rebase on Aug 7, 2024
  29. DrahtBot added the label CI failed on Aug 13, 2024
  30. DrahtBot commented at 7:50 pm on August 13, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/28438476134

    Make sure to run all tests locally, according to the documentation.

    The failure may happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  31. DrahtBot added the label Needs rebase on Aug 21, 2024
  32. ryanofsky force-pushed on Dec 9, 2024
  33. DrahtBot removed the label Needs rebase on Dec 9, 2024
  34. DrahtBot removed the label CI failed on Dec 9, 2024
  35. DrahtBot added the label CI failed on Dec 11, 2024
  36. DrahtBot removed the label CI failed on Dec 17, 2024
  37. DrahtBot added the label Needs rebase on Dec 18, 2024
  38. ryanofsky force-pushed on Mar 12, 2025
  39. DrahtBot removed the label Needs rebase on Mar 12, 2025
  40. DrahtBot added the label Needs rebase on Mar 14, 2025
  41. ryanofsky referenced this in commit 6d0745d22b on Apr 3, 2025
  42. ryanofsky force-pushed on Apr 3, 2025
  43. DrahtBot removed the label Needs rebase on Apr 3, 2025
  44. ryanofsky referenced this in commit 2be41ef85f on Apr 3, 2025
  45. ryanofsky referenced this in commit eaac991552 on Apr 4, 2025
  46. ryanofsky force-pushed on Apr 4, 2025
  47. DrahtBot added the label CI failed on Apr 4, 2025
  48. DrahtBot commented at 3:37 am on April 4, 2025: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/39937617956

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  49. DrahtBot removed the label CI failed on Apr 4, 2025
  50. DrahtBot added the label Needs rebase on Apr 8, 2025
  51. ryanofsky referenced this in commit 8e3ee9d7e7 on Oct 15, 2025
  52. ryanofsky referenced this in commit 9e7dabc35d on Oct 15, 2025
  53. ryanofsky force-pushed on Oct 15, 2025
  54. DrahtBot removed the label Needs rebase on Oct 15, 2025
  55. ryanofsky referenced this in commit a5700c7911 on Oct 16, 2025
  56. ryanofsky referenced this in commit e4ca362858 on Oct 16, 2025
  57. ryanofsky force-pushed on Oct 16, 2025
  58. DrahtBot added the label Needs rebase on Oct 29, 2025
  59. fanquake referenced this in commit 4da01123df on Nov 4, 2025
  60. ryanofsky referenced this in commit af46e97d08 on Nov 10, 2025
  61. ryanofsky referenced this in commit d0bd114e97 on Nov 10, 2025
  62. ryanofsky referenced this in commit 9883750ab0 on Nov 10, 2025
  63. ryanofsky referenced this in commit 6bbf29c5f8 on Nov 10, 2025
  64. ryanofsky force-pushed on Nov 10, 2025
  65. DrahtBot removed the label Needs rebase on Nov 11, 2025
  66. ryanofsky referenced this in commit 0926479924 on Nov 11, 2025
  67. ryanofsky force-pushed on Nov 11, 2025
  68. DrahtBot added the label Needs rebase on Nov 25, 2025
  69. ryanofsky referenced this in commit 45af98eb5a on Dec 12, 2025
  70. ryanofsky referenced this in commit 168128bb5e on Dec 12, 2025
  71. ryanofsky referenced this in commit 7c49fcfc21 on Dec 12, 2025
  72. ryanofsky referenced this in commit 2d0bc18b9f on Dec 12, 2025
  73. ryanofsky force-pushed on Dec 12, 2025
  74. DrahtBot removed the label Needs rebase on Dec 12, 2025
  75. DrahtBot added the label CI failed on Dec 12, 2025
  76. DrahtBot commented at 7:39 pm on December 12, 2025: contributor

    🚧 At least one of the CI tasks failed. Task ASan + LSan + UBSan + integer: https://github.com/bitcoin/bitcoin/actions/runs/20166570929/job/57895220709 LLM reason (✨ experimental): CTest failure: test_kernel failed (exit code 8) causing the CI to fail.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  77. DrahtBot added the label Needs rebase on Dec 14, 2025
  78. ryanofsky referenced this in commit fdcf06d4bb on Dec 16, 2025
  79. ryanofsky referenced this in commit 90476d0bb5 on Dec 16, 2025
  80. ryanofsky force-pushed on Dec 16, 2025
  81. DrahtBot removed the label Needs rebase on Dec 16, 2025
  82. DrahtBot added the label Needs rebase on Dec 16, 2025
  83. ryanofsky referenced this in commit 5d43d4a39c on Jan 18, 2026
  84. ryanofsky referenced this in commit ac3938a2f4 on Jan 18, 2026
  85. ryanofsky referenced this in commit 05d22deffd on Jan 18, 2026
  86. ryanofsky referenced this in commit c8f6a474f9 on Jan 18, 2026
  87. ryanofsky referenced this in commit 480f08b3bd on Jan 18, 2026
  88. ryanofsky force-pushed on Jan 18, 2026
  89. DrahtBot removed the label Needs rebase on Jan 18, 2026
  90. ryanofsky force-pushed on Jan 18, 2026
  91. DrahtBot removed the label CI failed on Jan 18, 2026
  92. DrahtBot added the label Needs rebase on Jan 19, 2026
  93. kernel: Simplify logging API
    Current kernel logging API is too complicated and too restrictive. This PR
    tries to improves it.
    
    I'd expect an API that supported logging to allow creating log streams with
    different options and providing some way to specify which library operations
    should be logged to which streams.
    
    By contrast, the current API allows creating multiple log streams, but all the
    streams receive the same messages because options can only be set globally and
    the stream objects can't be passed to any kernel API functions. They are not
    even referenced by the `btck_Context` struct which holds other shared state. If
    no log streams are created, log messages are generated anyway, but they are
    stored in a 1MB buffer and not sent anywhere, unless a log stream is created
    later, at which point they are sent in bulk to that stream. More log streams
    can be created after that, but they only receive new messages, not the buffered
    ones. If log output is not needed, a btck_logging_disable() call is required to
    prevent log messages from accumulating in the 1MB buffer. Calling this will
    abort the program if any log streams were created before it was called, and
    also abort the program if any new log streams are created later.
    
    None of these behaviors seem necessary or ideal, and it would be better to
    provide a simpler logging API that allows creating a log stream, setting
    options on it, registering it with the `btck_Context` instance and receiving
    log messages from it. Another advantage of this approach is that it could allow
    (with #30342) different log streams to be used for different purposes, which
    would be not be possible with the current interface.
    6d370c720a
  94. ryanofsky referenced this in commit cde4ae89a0 on Jan 22, 2026
  95. ryanofsky force-pushed on Jan 22, 2026
  96. DrahtBot removed the label Needs rebase on Jan 23, 2026
  97. DrahtBot added the label Needs rebase on Jan 29, 2026
  98. ryanofsky force-pushed on Feb 3, 2026
  99. ryanofsky force-pushed on Feb 3, 2026
  100. DrahtBot added the label CI failed on Feb 3, 2026
  101. DrahtBot commented at 7:53 pm on February 3, 2026: contributor

    🚧 At least one of the CI tasks failed. Task macOS native: https://github.com/bitcoin/bitcoin/actions/runs/21643951237/job/62390928227 LLM reason (✨ experimental): CI failure caused by the Bitcoin Kernel Test Suite aborting (SIGABRT) in the test_kernel tests.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  102. DrahtBot removed the label Needs rebase on Feb 3, 2026
  103. ryanofsky force-pushed on Feb 3, 2026
  104. DrahtBot removed the label CI failed on Feb 3, 2026
  105. DrahtBot added the label Needs rebase on Feb 8, 2026
  106. log test: Add test for currently accepted logging arguments
    Test will be extended in next commit to cover support for context objects.
    6f470d3cb8
  107. log test: verify log argument evaluation semantics
    Test that LogInfo/LogWarning/LogError always evaluate their arguments
    even when logging is disabled.
    
    ajtowns pointed out this behavior was important and could affect non-logging
    code if changed in
    https://github.com/bitcoin/bitcoin/pull/34374#discussion_r2734793117
    10d36911c0
  108. log refactor: Allow log macros to accept source arguments
    Allow LogDebug(), LogTrace(), LogInfo(), LogWarning(), and LogError() macros to
    accept source arguments to provide more information in log messages and more
    control over logging to callers.
    
    This functionality is used in followup PRs:
    
    - https://github.com/bitcoin/bitcoin/pull/30342 - To let libbitcoinkernel send
      output to specfic `BCLog::Logger` instances instead of a global instance, so
      output can be disambiguated and applications can have more control over
      logging.
    
    - https://github.com/bitcoin/bitcoin/pull/30343 - To replace custom
      `WalletLogPrintf` calls with standard logging calls that automatically include
      wallet names and don't log everything at info level.
    
    This commit does not change behavior of current log prints or require them to
    be updated. It includes tests and documentation covering the new functionality.
    
    Co-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>
    Co-Authored-By: stickies-v <stickies-v@protonmail.com>
    8714e10178
  109. log refactor: Add support for custom log sources
    Custom log sources allow overridding log formatting and adding metadata, such
    as request ids or wallet names to log messages, while still using standard
    macros for logging. This is used to replace WalletLogPrintf() functions with
    LogInfo() calls in followup PR #30343.
    fd8d0a1039
  110. log refactor: Add preprocessor workaround for MSVC
    Needed to fix errors like:
    
    const Context &GetContext(const Context &)': expects 1 arguments - 3 provided
    
    due to a compiler bug:
    
    https://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly/5134656#5134656
    
    Example CI failure:
    
    https://github.com/bitcoin/bitcoin/actions/runs/8072891468/job/22055528830?pr=29256
    f09cc447a7
  111. log refactor: Disallow category args to logging macros
    Disallow passing BCLog category constants to LogInfo(), LogWarning(), and
    LogError() macros and do not not log categories at these levels. Also disallow
    omitting BCLog categories when calling LogDebug() and LogTrace() macros.
    
    These restrictions are not technically neccessary, but they are also not new.
    Parent commit "accept source arguments" dropped them for simplicity, but
    https://github.com/bitcoin/bitcoin/pull/29256#discussion_r2040671181 and
    similar comments have suggested these restrictions are good, so this commit
    just restores them while documenting them better and providing clear error
    messages when categories are passed but disallowed, or required but not passed.
    
    Co-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>
    487f7e77cf
  112. Merge branch 'pr/bclog' into pr/gklog 0be491470e
  113. Merge branch 'pr/klog' into pr/gklog 6b46fa3072
  114. refactor: Pass Logger instances to kernel objects
    Pass Logger instances to BlockManager, CCoinsViewDB, CDBWrapper,
    ChainstateManager, and CoinsViews instances so libbitcoinkernel applications
    and test code have the option to control where log output goes instead of
    having all output sent to the global logger.
    
    This commit just passes the logger objects without using them. The next commit
    updates log print statements to use the new objects.
    bb99c4103d
  115. refactor: Log kernel output to local log instances
    This is a mechanical change updating kernel code that currently uses the global
    log instance to log to local instances instead.
    c864c8a84f
  116. refactor: Pass Logger instance to CTxMemPool
    This allows libbitcoinkernel applications and test code to have the option to
    control where log output goes instead of having all output sent to the global
    logger.
    aa11409e59
  117. kernel: Drop global Logger instance
    Change LogInstance() function to no longer allocate (and leak) a BCLog::Logger
    instance. Instead allow kernel applications to initialize their own logging
    instances that can be returned by LogInstance().
    
    The LogInstance() function is not actually used for the majority of logging in
    kernel code. Most kernel log output goes directly to BCLog::Logger instances
    specified when kernel objects like ChainstateManager and CTxMemPool are
    constructed, which allows applications to create multiple Logger instances and
    control which log output is sent to them.
    
    The only kernel code that does rely on LogInstance() is certain low level code in
    the util library, like the RNG seeder, that is not passed a specific instance
    and needs to rely on the global LogInstance() function.
    
    Other code outside the kernel library uses LogInstance() heavily, and may
    continue to do so. bitcoind and test code now just create a log instance before
    the first LogInstance() call, which it returns, so all behavior is the same as
    before.
    eeb84002a8
  118. test-each-commit: Increase fetch depth
    Needed due to base PR, can be dropped before merge
    8bafdfed01
  119. ryanofsky referenced this in commit 3a73b718e4 on Feb 9, 2026
  120. ryanofsky referenced this in commit 2819b6d067 on Feb 9, 2026
  121. ryanofsky force-pushed on Feb 9, 2026
  122. DrahtBot removed the label Needs rebase on Feb 9, 2026
  123. ryanofsky force-pushed on Feb 9, 2026
  124. DrahtBot added the label CI failed on Feb 9, 2026
  125. DrahtBot commented at 4:49 pm on February 9, 2026: contributor

    🚧 At least one of the CI tasks failed. Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/21830259022/job/62995439943 LLM reason (✨ experimental): CI failure caused by an IWYU (Include-What-You-Use) check failing.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  126. ryanofsky force-pushed on Feb 9, 2026
  127. DrahtBot removed the label CI failed on Feb 9, 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-02-11 00:13 UTC

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