bitcoin/test/functional/test_framework
Wladimir J. van der Laan b805dbb0b9
Merge #19809: log: Prefix log messages with function name and source code location if -logsourcelocations is set
b4511e2e2e log: Prefix log messages with function name if -logsourcelocations is set (practicalswift)

Pull request description:

  Prefix log messages with function name if `-logfunctionnames` is set.

  Yes, exactly like `-logthreadnames` but for function names instead of thread names :)

  This is a small developer ergonomics improvement: I've found this to be a cheap/simple way to correlate log output and originating function.

  For me it beats the ordinary cycle of 1.) try to figure out a regexp matching the static part of the dynamic log message, 2.) `git grep -E 'Using .* MiB out of .* requested for signature cache'`, 3.) `mcedit filename.cpp` (`openemacs filename.cpp` works too!) and 4.) search for log message and scroll up to find the function name :)

  Without any logging parameters:

  ```
  $ src/bitcoind -regtest
  2020-08-25T03:29:04Z Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z block tree size = 1
  2020-08-25T03:29:04Z nBestHeight = 0
  2020-08-25T03:29:04Z Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z 0 addresses found from DNS seeds
  ```

  With `-logthreadnames` and `-logfunctionnames`:

  ```
  $ src/bitcoind -regtest -logthreadnames -logfunctionnames
  2020-08-25T03:29:04Z [init] [ReportHardwareRand] Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z [init] [InitSignatureCache] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [InitScriptExecutionCache] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [LoadChainTip] Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z [init] [AppInitMain] block tree size = 1
  2020-08-25T03:29:04Z [init] [AppInitMain] nBestHeight = 0
  2020-08-25T03:29:04Z [loadblk] [LoadMempool] Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z [dnsseed] [ThreadDNSAddressSeed] 0 addresses found from DNS seeds
  ```

ACKs for top commit:
  laanwj:
    Code review ACK b4511e2e2e
  MarcoFalke:
    review ACK b4511e2e2e 🌃

Tree-SHA512: d100f5364630c323f31d275259864c597f7725e462d5f4bdedcc7033ea616d7fc0d16ef1b2af557e692f4deea73c6773ccfc681589e7bf6ba970b9ec169040c7
2021-02-18 14:37:51 +01:00
..
__init__.py Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
address.py [tests] Replace bytes literals with hex literals 2020-09-03 16:47:49 +01:00
authproxy.py test: retry when write to a socket fails on macOS 2020-06-25 17:26:20 +07:00
bdb.py test: remove unnecessary assignment in bdb 2021-02-09 10:22:50 -03:00
bip340_test_vectors.csv tests: add BIP340 Schnorr signature support to test framework 2020-10-12 17:18:47 -07:00
blocktools.py scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
coverage.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
descriptors.py Output a descriptor in createmultisig and addmultisigaddress 2020-01-30 23:55:36 -05:00
key.py test: remove unused function xor_bytes 2021-02-09 17:58:21 +01:00
messages.py [test] Add P2P_SERVICES to p2p.py 2021-02-17 09:29:41 +00:00
muhash.py test: Change MuHash Python implementation to match cpp version again 2020-12-22 01:48:34 +01:00
netutil.py doc: Use https URLs where possible 2021-01-04 12:23:16 +08:00
p2p.py [test] Add P2P_SERVICES to p2p.py 2021-02-17 09:29:41 +00:00
script.py test: remove type: comments in favour of actual annotations 2021-02-08 13:24:44 +08:00
script_util.py scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
segwit_addr.py [tests] Rename segwit encode and decode functions 2020-09-03 16:47:49 +01:00
siphash.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
socks5.py scripted-diff: Update copyright in ./test 2019-03-02 10:58:35 -05:00
test_framework.py Merge #20267: Disable and fix tests for when BDB is not compiled 2021-02-05 14:26:10 +01:00
test_node.py Merge #19809: log: Prefix log messages with function name and source code location if -logsourcelocations is set 2021-02-18 14:37:51 +01:00
test_shell.py TestShell: Return self from setup() 2019-11-05 12:55:52 +01:00
util.py Merge #17556: test: Change feature_config_args.py not to rely on strange regtest=0 behavior 2021-01-21 16:51:19 +01:00
wallet.py rpc: Return wtxid from testmempoolaccept 2021-01-12 18:43:43 +01:00
wallet_util.py [tests] move generate_wif_key to wallet_util.py 2020-06-10 12:10:02 -04:00