Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Jun 26, 2024

  1. logging: Improve new LogDebug/Trace/Info/Warning/Error Macros

    Improve new LogDebug(), LogTrace(), LogInfo(),  LogWarning(), LogError() macros
    introduced in bitcoin#28318:
    
    - Make them always accept log categories to make it possible to only log
      messages from a particular component.
    - Make them not rely on a global LogInstance, to provide better control of
      logging in controlled environments, such as unit tests that want to
      selectively capture log output, or libbitcoinkernel applications that want to
      have multiple instances of validation objects without mixing their log output.
    - Make them consistent, now all accepting the same parameters.
    - Make them less verbose by not requiring BCLog category constants to be
      specified in individual log prints
    ryanofsky committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    9d9c1e8 View commit details
    Browse the repository at this point in the history
  2. logging: Add preprocessor workaround for MSVC

    Needed to fix errors like:
    
    const Source &_LogSource(const Source &)': expects 1 arguments - 3 provided
    const Source &_LogSource(const Source &)': 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
    ryanofsky committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    5f64eab View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8c5ecae View commit details
    Browse the repository at this point in the history
  4. 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.
    ryanofsky committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    e9b91f5 View commit details
    Browse the repository at this point in the history
  5. 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.
    ryanofsky committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    facc2d0 View commit details
    Browse the repository at this point in the history
  6. 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.
    ryanofsky committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    db1b9f7 View commit details
    Browse the repository at this point in the history