Page MenuHomePhabricator

[wallet] Add wallet name to log messages
ClosedPublic

Authored by nakihito on Dec 11 2019, 00:36.

Details

Reviewers
deadalnix
Fabien
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rSTAGING2720d3db04d6: [wallet] Add wallet name to log messages
rABC2720d3db04d6: [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.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR12992
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8493
Build 14994: Default Diff Build & Tests
Build 14993: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Dec 11 2019, 00:36

Added PR13911 because it revets some changes and clarifies logs.

nakihito retitled this revision from Merge #12992: [wallet] Add wallet name to log messages to [wallet] Add wallet name to log messages.Dec 11 2019, 00:48
nakihito edited the summary of this revision. (Show Details)
nakihito edited the test plan for this revision. (Show Details)
nakihito planned changes to this revision.
nakihito edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 12 2019, 22:21