Remove #define printf, replace OutputDebugStringf with LogPrint(f) #3009

pull gavinandresen wants to merge 2 commits into bitcoin:master from gavinandresen:LogPrint changing 29 files +389 −399
  1. gavinandresen commented at 10:50 am on September 18, 2013: contributor

    I finally got fed up enough with our lousy logging to do something about it.

    So: I replaced all instances of printf() in our code with either LogPrint or LogPrintf.

    LogPrintf(“foo\n”); is a straight replacement for printf/OutputDebugStringf(“foo\n”). It writes printf-formatted arguments to debug.log (or console if -printtoconsole). Use it for messages that should always go into debug.log (errors, startup info, etc).

    LogPrint(“category”, …); is new– it only logs if you pass a -debug=category flag. Run with multiple -debug= arguments to log more than one category (e.g. bitcoind -debug=net -debug=mempool ). I defined the following categories: net mempool rpc alert db addr addrman coindb rand

    If y’all like this, feel free to add more categories, rename/combine these, etc.

  2. Refactor: OutputDebugStringF -> LogPrint(category, ...) e51321fb75
  3. Replace printf with LogPrintf / LogPrint 881a85a22d
  4. jgarzik referenced this in commit e0d6dd11e3 on Sep 18, 2013
  5. jgarzik merged this on Sep 18, 2013
  6. jgarzik closed this on Sep 18, 2013

  7. jgarzik commented at 11:01 am on September 18, 2013: contributor

    Agree 100% that calling this printf() causes no end of a annoying problems and minor confusions.

    Went ahead and merged this, because otherwise it will quickly and perpetually be out-of-date.

    If anybody thinks this is NAK-worthy, still speak up, and we can back it out (though I hope not).

  8. sipa commented at 11:15 am on September 18, 2013: member
    Posthumous ACK.
  9. laanwj commented at 11:23 am on September 18, 2013: member
    ACK, finally!
  10. BitcoinPullTester commented at 10:48 pm on September 19, 2013: none

    Automatic sanity-testing: FAILED BUILD/TEST, see http://jenkins.bluematt.me/pull-tester/881a85a22d76c875f519cd54388a419ec6f70857 for binaries and test log.

    This could happen for one of several reasons:

    1. It chanages paths in makefile.linux-mingw or otherwise changes build scripts in a way that made them incompatible with the automated testing scripts (please tweak those patches in qa/pull-tester)
    2. It adds/modifies tests which test network rules (thanks for doing that), which conflicts with a patch applied at test time
    3. It does not build on either Linux i386 or Win32 (via MinGW cross compile)
    4. The test suite fails on either Linux i386 or Win32
    5. The block test-cases failed (lookup the first bNN identifier which failed in https://github.com/TheBlueMatt/test-scripts/blob/master/FullBlockTestGenerator.java)

    If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here.

    This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  11. rebroad commented at 3:46 am on February 25, 2014: contributor

    NACK! There is far too much debug.log output now:-

    2014-02-25 03:45:50 sending getdata: tx 7007611c2899e2e7fd26d715d9dbadee0427a5967e586b7f2f3bc3c4f10f86e1 2014-02-25 03:45:50 sending: getdata (469 bytes) 2014-02-25 03:45:51 received: tx (227 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 received: tx (225 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 received: tx (471 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (73 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 received: tx (473 bytes) 2014-02-25 03:45:51 sending: inv (109 bytes) 2014-02-25 03:45:51 received: tx (375 bytes) 2014-02-25 03:45:51 sending: inv (73 bytes) 2014-02-25 03:45:51 received: tx (226 bytes) 2014-02-25 03:45:51 sending: inv (73 bytes) 2014-02-25 03:45:51 received: tx (438 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 received: tx (258 bytes) 2014-02-25 03:45:51 received: tx (226 bytes) 2014-02-25 03:45:51 sending: inv (289 bytes) 2014-02-25 03:45:51 sending: inv (73 bytes) 2014-02-25 03:45:51 received: tx (226 bytes) 2014-02-25 03:45:51 sending: inv (325 bytes) 2014-02-25 03:45:51 received: tx (258 bytes) 2014-02-25 03:45:51 sending: inv (361 bytes) 2014-02-25 03:45:51 received: tx (226 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (73 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 received: tx (438 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (397 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:51 sending: inv (37 bytes) 2014-02-25 03:45:52 sending: inv (73 bytes) 2014-02-25 03:45:52 sending: inv (73 bytes) 2014-02-25 03:45:52 received: addr (61 bytes) 2014-02-25 03:45:52 sending: addr (31 bytes) 2014-02-25 03:45:52 sending: inv (217 bytes) 2014-02-25 03:45:52 sending: addr (31 bytes) 2014-02-25 03:45:53 sending: inv (361 bytes) 2014-02-25 03:45:54 sending: addr (31 bytes) 2014-02-25 03:45:54 received: addr (31 bytes) 2014-02-25 03:45:54 sending: addr (31 bytes) 2014-02-25 03:45:55 sending: addr (31 bytes) 2014-02-25 03:45:56 received: inv (73 bytes)

    Can we do something to reduce this without stopping the useful debug.log info that was there previously?

  12. Bushstar referenced this in commit c6eededcab on Apr 8, 2020
  13. Bushstar referenced this in commit 9ac7a998be on Apr 8, 2020
  14. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me