HomePhabricator

logging: add LogError, LogWarning, LogInfo, LogDebug, LogTrace

Description

logging: add LogError, LogWarning, LogInfo, LogDebug, LogTrace

Summary:
These provide simple and clear ways to write the most common logging
operations:

LogInfo("msg");
LogDebug(BCLog::LogFlags::NET, "msg");

LogError("msg");
LogWarning("msg");
LogTrace(BCLog::LogFlags::NET, "msg");

For cases where the level cannot be hardcoded, LogPrintLevel(category,
level, ...) remains available.

This is a partial backport of core#28318
https://github.com/bitcoin/bitcoin/pull/28318/commits/f7ce5ac08c669ac763e275bb7c82dcfb2b1b6c33
Depends on D18274

Test Plan:

arc lint
ninja all check-all

in the next diff try removing some "\n" in the newly added LogInfo/LogWarning lines, see that the linter catches the issue.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18275

Details

Provenance
Anthony Towns <aj@erisian.com.au>Authored on Aug 22 2023, 03:23
PiRKCommitted on Jun 20 2025, 08:41
PiRKPushed on Jun 20 2025, 08:41
Reviewer
Restricted Project
Differential Revision
D18275: logging: add LogError, LogWarning, LogInfo, LogDebug, LogTrace
Parents
rABC17e3f6172685: logging: add -loglevelalways=1 option
Branches
Unknown
Tags
Unknown