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

full analysis

https://github.com/bitcoin/bitcoin/pull/34730 · ajtowns · +63/-57 in 7 files, 2 commits · labels: Needs rebase · draft

Goal

  • Remove ambiguity between warning and error log levels for developers and node operators
  • Eliminate a historical distinction that node operators already observe directly

This pull request merges the LogWarning and LogError logging levels into a single LogAlert level (BCLog::Level::Alert). It retains LogWarning and LogError as compatibility aliases, updates developer notes, and converts src/node/blockstorage.cpp call sites via a scripted diff.

Problem: Developers and node operators face ambiguity between LogWarning and LogError, where the only historical distinction was whether the node was shutting down, which node admins already observe directly.

Category: Utilities (logging, arguments, libraries) (#60 of 66)

P4 · cleanup

  • P4 because it is a minor ergonomic cleanup to internal logging levels
  • Offers cosmetic consistency across call sites without fixing bugs or stability issues

P4 because this is a minor cleanup to logging API ergonomics. As ajtowns states, 'There's little benefit in having two error levels... so this PR replaces LogWarning and LogError with LogAlert.' It offers cosmetic consistency across logging calls rather than addressing bugs or stability.

Membership: Modifies core logging utilities in src/util/log.h and src/logging.cpp by introducing BCLog::Level::Alert and replacing LogWarning/LogError macros.

Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0

Reviewability: Stale: Needs rebase

  • Needs rebase due to merge conflicts with other open logging changes
  • Review #34038 first

The PR has merge conflicts with several open logging PRs, requires a rebase, and the author has been silent for 197 days while keeping it in draft pending #34038.

Author status: silent since 2026-03-04

Open concerns:

  • ryanofsky prefers keeping error and warning levels as conditional logs and introducing a new unconditional LogCritical macro instead of combining them into LogAlert

Agreement: Positive w/ caveats

  • Code review approval despite reservations about the chosen design (ryanofsky)
  • Prefers keeping warning and error separate while adding a critical level (ryanofsky)

Approved with reservations; ryanofsky gave Concept -0 preferring a critical level instead, but accepted the change.

ryanofsky submitted an approved code review but noted Concept -0, outlining an alternative approach keeping warning/error levels separate and adding a critical level instead.

  • ryanofsky: 'Code review ACK 4ce720ba... 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.'

Review verdicts (DrahtBot): 1

Dependencies

Depends on: #34038

Files

26 lines under test/bench/ci.

  • src/node/blockstorage.cpp +24/-24
  • src/test/logging_tests.cpp +12/-8
  • doc/developer-notes.md +9/-9
  • src/logging.cpp +9/-9
  • src/util/log.h +6/-4
  • test/functional/feature_config_args.py +2/-2
  • test/functional/feature_coinstatsindex_compatibility.py +1/-1

Card

This PR simplifies the logging interface by consolidating LogWarning and LogError into a single LogAlert macro and adding BCLog::Level::Alert, while retaining the old macros as deprecated aliases. The change resolves ambiguity regarding when to log an error versus a warning when alerting node operators. It represents a low-priority internal cleanup for the utility logging subsystem. It is currently in draft awaiting PR 34038, has merge conflicts, and has been silent for over six months with an approved code review from ryanofsky noting reservations on concept direction.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T16:17, confidence high, input hash 6bfe6bd759060166