mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 21:57:54 +02:00
22335474d7net: format peer+addr logs with `LogPeer` (Lőrinc)e55ea534f7test: add pre-`LogPeer` net log assertion (Lőrinc)736b17c0f0log: fix minor formatting in debug logs (Lőrinc)9cf82bed32log: show placeholders for missing peer fields (Lőrinc) Pull request description: This is an alternative to #34293, but aims to address the remaining logging inconsistencies more broadly. It extends the example fixed there to every instance, restores the original separator behavior, applies it consistently via a single helper, and adds tests for `logips` (covering both current and new behavior). ### Problem After #28521 centralized peer address logging into `CNode::LogIP()`, the original comma separator before `peeraddr=` was lost, resulting in inconsistent formatting across net (and recent private broadcast) logs. Some lines also had double spaces, empty fields, or mismatched format specifiers. ### Fix Introduces `CNode::LogPeer(bool)` which always emits `peer=<id>` and, when `-logips=1`, appends `, peeraddr=<addr>`. This eliminates hand-rolled separators and makes peer identification predictable. Minor issues (double spaces, empty placeholders, format specifiers) are fixed along the way in separate commits. ### Reproducer Run with `-debug=net -logips=1` and observe peer log lines now show `peer=<id>, peeraddr=<addr>` (comma-separated). The new assertion in `feature_logging.py` automates this check. ACKs for top commit: naiyoma: ACK22335474d7vasild: ACK22335474d7sedited: ACK22335474d7Tree-SHA512: 562262a58c3042f139099ff4c41e3fc6a97505fe9603c2bf700a97fd0aa052954b47c14da0e50c1fc311db1ae6c04e6a92156c9b85e25c777a637b7766c1dafe