Merge bitcoin/bitcoin#34033: scripted-diff: Unify error and warning log formatting

fa89f60e31 scripted-diff: LogPrintLevel(*,BCLog::Level::*,*) -> LogError()/LogWarning() (MarcoFalke)
fa6c7a1954 scripted-diff: LogPrintLevel(*,BCLog::Level::Debug,*) -> LogDebug() (MarcoFalke)

Pull request description:

  Errors and warnings should normally not happen. However, if they do happen, it is easier to spot them, if they are all logged in the same format via `LogError` or `LogWarning`.

  So do that with a scripted-diff.

  This is a minimal behavior change and unifies the log output from:

      [net:error] Something bad happened
      [net:warning] Something problematic happened

  to either

      [error] Something bad happened
      [warning] Something problematic happened

  or, when `-loglevelalways=1` is enabled:

      [all:error] Something bad happened
      [all:warning] Something problematic happened

  Such a behavior change is desired, because all warning and error logs are written in the same style in the source code and they are logged in the same format for log consumers.

  Removing the category should be harmless, because warning and error messages should be descriptive and unique anyway.

ACKs for top commit:
  ajtowns:
    ACK fa89f60e31
  stickies-v:
    ACK fa89f60e31
  rkrux:
    lgtm code review ACK fa89f60e31

Tree-SHA512: dafa47ab561609a79005faf008fe188dd714f6e07bb2dfbe4db49290d6636b12eb7ac4a18ed32bcc5526641a9f258dbc37c08e10c223ec068b97976590ff0b52
This commit is contained in:
merge-script
2025-12-11 09:00:18 -08:00
10 changed files with 72 additions and 72 deletions

View File

@@ -2795,7 +2795,7 @@ bool Chainstate::FlushStateToDisk(
// TODO: Handle return error, or add detailed comment why it is
// safe to not return an error upon failure.
if (!m_blockman.FlushChainstateBlockFile(m_chain.Height())) {
LogPrintLevel(BCLog::VALIDATION, BCLog::Level::Warning, "%s: Failed to flush block file.\n", __func__);
LogWarning("%s: Failed to flush block file.\n", __func__);
}
}