HomePhabricator

[wallet] Add wallet name to log messages

Description

[wallet] Add wallet name to log messages

Summary:
909f54c80abb7195c2e82c6e06c414f4526a339e [wallet] Add wallet name to log messages (Pierre Rochard)
c4a884d555 Trivial: Revert translated string change, clarify wallet log messages (Pierre Rochard)

Pull request description:

After multiple wallets became supported, wallet-related log messages became ambiguous as to which wallet they were being emitted by.

This pull request adds a `CWallet::WalletLogPrintf` function to be used when logging wallet-specific events. This function prepends the wallet's name to the log message and forwards it to `LogPrintf`

fixes #11317

Tree-SHA512: d258dcc9aa0f1330159bc66b4020f84709c5bba5165bdc62503543557d8999777f0b94a7a82a08823e2b2ceb84f4f8d1cd5493f99c076a13539f1f6155dc55ad

Tree-SHA512: 002d8a69b489fd216e15b7d6200d7117c489b32405d5e9f514f120d43113fd97ca2f235452b0093e0760bc03baf714edc4564ae14af8456e1b2a54f83c577bf3

Backport of Core PR12992 and PR13911
https://github.com/bitcoin/bitcoin/pull/12992/
https://github.com/bitcoin/bitcoin/pull/13911/

Test Plan:

arc lint --everything
make check
./bitcoind

Verify there is a wallet name attached to log files right after the init message: Loading Wallet ... line(s) like so:

[default wallet] nFileVersion = 200900
[default wallet] Wallet completed loading in              76ms

Add the following lines to anyfile:

LogPrint("Hello World");
LogPrintf("Hello World");
WalletLogPrint("Hello World");
WalletLogPrintf("Hello World");

After running the linter, there should be 4 different error messages with the following error message:

(LOGS1) Missing a newline at the end of the log message.
If this is deliberate, please use the `(Wallet)LogPrint*ToBeContinued()`
method instead.

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Aug 6 2018, 14:43
nakihitoCommitted on Dec 13 2019, 00:02
nakihitoPushed on Dec 13 2019, 00:08
Reviewer
Restricted Owners Package
Differential Revision
D4691: [wallet] Add wallet name to log messages
Parents
rSTAGINGde161431a20e: [tests] Fix race in rpc_deprecated.py
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/14819