util/log: Combine the warning/error log levels into a single alert level #34730

pull ajtowns wants to merge 2 commits into bitcoin:master from ajtowns:202603-logalert changing 7 files +63 −57
  1. ajtowns commented at 12:03 pm on March 4, 2026: contributor

    There’s little benefit in having two error levels that the node operator should pay attention to when the only difference between them is that one means the node is about to shut down – the admin can easily see that just by looking at whether the node did shutdown. So this PR replaces LogWarning and LogError with LogAlert, which hopefully emphasises that the point of using that level is to alert the node operator.

    Leaves LogWarning and LogError available as deprecated aliases to reduce code churn and avoid invalidating PRs.

    Left as draft pending #34038 as the “warning” and “error” levels are currently exposed to users via the -loglevel config option.

  2. util/log: Replace LogWarning/LogError with LogAlert 7113b17d85
  3. scripted-diff: Convert node/blockstorage.cpp to LogAlert
    -BEGIN VERIFY SCRIPT-
    sed -i 's/LogWarning(/LogAlert(/g; s/LogError(/LogAlert(/g; s/\(LogAlert("[^\"]*\)\\n\("[,)]\)/\1\2/g' src/node/blockstorage.cpp
    -END VERIFY SCRIPT-
    4ce720ba87
  4. DrahtBot commented at 12:03 pm on March 4, 2026: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky

    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:

    • #34038 (logging: replace -loglevel with -trace, various API improvements by ajtowns)
    • #30361 (doc: Drop description of LogError messages as fatal by ryanofsky)
    • #30343 (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
    • #29256 (log, refactor: Allow log macros to accept context arguments 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.

  5. ajtowns commented at 12:04 pm on March 4, 2026: contributor
    Previous discussion: #30348 and #30364
  6. ryanofsky approved
  7. ryanofsky commented at 9:00 pm on March 6, 2026: contributor

    Code review ACK 4ce720ba8738b480fbd9244776ce1c7b01fc591a. Concept -0.

    This PR is definitely not the change I would make, but it seems fine and helps decrease the gap between way the macros are actually used and the way they were originally intended to be used.

    IMO, a more ideal solution would:

    1. Keep the error and warning levels instead of removing them, because [error] [warning] tags shown in log output are helpful for distinguishing actual problems from potential problems from informational messages.
    2. Make error and warning log levels conditional (users can configure whether messages are logged) instead of unconditional.
    3. Introduce a new “critical” level and LogCritical macro which is unconditional and always logs even when debug logging is turned off. To me “critical” sounds more negative and “alert” sounds more fake like “Alert! Walmart’s prices are lower than competitors”. But obviously the word choice is not important.

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-03-09 12:13 UTC

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